I have a PNG image and a video file and I want to merge them together into one
video file. All of the work should be done under Linux.
1. The PNG image has 1280x720 resolution and I converted it to *.mp4 file using
the following command:
$ ffmpeg -loop 1 -r 24 -i image.png -t 00:00:05 -vcodec h264 -pix_fmt yuv420p
-an image.mp4
2. The video was created via pipe using the following command (pay attention to
its last line):
$ gource -s 2 --auto-skip-seconds 0.1 --file-idle-time 0 --max-files 500
--multi-sampling --bloom-multiplier 0.9 \
--bloom-intensity 0.4 -1280x720 --stop-at-end --output-ppm-stream - history.xml
\
| ffmpeg -y -r 24 -f image2pipe -vcodec ppm -i - -vcodec libx264 -preset
ultrafast -pix_fmt yuv420p video.mp4
3. Then I merged them in one video. The list of input files:
$ cat files.txt
file 'image.mp4'
file 'video.mp4'
This command was used to concatenate the files:
$ ffmpeg -f concat -i files.txt -c:v copy result.mp4
This command printed the following message, not sure if it is important:
[concat @ 0xc83b90] Estimating duration from bitrate, this may be inaccurate
4. Finally, I open result video with mplayer. I see the first image for 5
seconds, as expected. Then, when the second video should start, mplayer "hangs"
and the following messages appear in the console:
[h264 @ 0x7f8e00260520]deblocking_filter_idc 16 out of range
[h264 @ 0x7f8e00260520]decode_slice_header error
[h264 @ 0x7f8e00260520]Missing reference picture, default is 65539
[h264 @ 0x7f8e00260520]Missing reference picture, default is 65539
...
[h264 @ 0x7f8e00260520]cabac_init_idc 32 overflow
[h264 @ 0x7f8e00260520]decode_slice_header error
[h264 @ 0x7f8e00260520]illegal reordering_of_pic_nums_idc
[h264 @ 0x7f8e00260520]decode_slice_header error
[h264 @ 0x7f8e00260520]abs_diff_pic_num overflow
...
[h264 @ 0x7f8e00260520]top block unavailable for requested intra mode at 3 0
[h264 @ 0x7f8e00260520]error while decoding MB 3 0, bytestream 2463
[h264 @ 0x7f8e00260520]number of reference frames (0+5) exceeds max (4;
probably corrupt input), discarding one
[h264 @ 0x7f8e00260520]Cannot use next picture in error concealment
[h264 @ 0x7f8e00260520]concealing 3600 DC, 3600 AC, 3600 MV errors in P frame
[h264 @ 0x7f8e00260520]number of reference frames (0+5) exceeds max (4;
probably corrupt input), discarding one
[h264 @ 0x7f8e00260520]Cannot use next picture in error concealment
[h264 @ 0x7f8e00260520]concealing 3571 DC, 3571 AC, 3571 MV errors in P frame
...
[h264 @ 0x7f8e00260520]top block unavailable for requested intra4x4 mode -1 at
59 0
...
[h264 @ 0x7f8e00260520]deblocking_filter_idc 3 out of range
[h264 @ 0x7f8e00260520]decode_slice_header error
[h264 @ 0x7f8e00260520]Missing reference picture, default is 65536
[h264 @ 0x7f8e00260520]Missing reference picture, default is 65536
[h264 @ 0x7f8e00260520]Reference 5 >= 4
[h264 @ 0x7f8e00260520]error while decoding MB 49 0, bytestream 50981
[h264 @ 0x7f8e00260520]Cannot use next picture in error concealment
[h264 @ 0x7f8e00260520]concealing 3600 DC, 3600 AC, 3600 MV errors in P frame
Any ideas what could be wrong?
Here is ffmpeg's info about my video files:
$ ffmpeg -i image.mp4
[h264 @ 0x8e2f40] Warning: not compiled with thread support, using thread
emulation
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'image.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf55.33.100
Duration: 00:00:03.00, start: 0.00, bitrate: 46 kb/s
Stream #0:0(und): Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661),
yuv444p, 1280x720 [SAR 1260:1273 DAR 2240:1273], 41 kb/s, 29.97 fps, 29.97 tbr,
11988 tbn, 59.94 tbc (default)
Metadata:
handler_name : VideoHandler
$ ffmpeg -i video.mp4
[h264 @ 0x15e7f30] Warning: not compiled with thread support, using thread
emulation
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf55.33.100
Duration: 00:19:17.38, start: 0.00, bitrate: 2646 kb/s
Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661),
yuv420p, 1280x720, 2645 kb/s, 24 fps, 24 tbr, 12288 tbn, 48 tbc (default)
Metadata:
handler_name : VideoHandler
$ ffmpeg -i result.mp4
[h264 @ 0x119bf30] Warning: not compiled with thread support, using thread
emulation
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'result.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf55.33.100
Duration: 00:19:22.46, start: 0.00, bitrate: 2635 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720
[SAR 1260:1273 DAR 2240:1273], 2634 kb/s, 24 fps, 24 tbr, 12288 tbn, 48 tbc
(default)
Metadata:
handler_name : VideoHandler
ffmpeg info:
$ ffmpeg version 2.2.7
built on Oct 4 2014 16:07:27 with gcc 4.7.3 (Gentoo 4.7.3-r1 p1.4, pie-0.5.5)
configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64
--mandir=/usr/share/man --enable-shared --cc=x86_64-pc