[FFmpeg-user] A problem with file encoding (possible bug)
Alexander Bokovikov
openworld at uralweb.ru
Thu Dec 8 16:55:54 CET 2011
On 08.12.2011, at 6:03, Carl Eugen Hoyos wrote:
> Alexander Bokovikov <openworld <at> uralweb.ru> writes:
>
>> Here is the FLV file sample:
>> http://home.bokovikov.com/ffmpeg/test.flv
>
> Apart from the command line, complete, uncut console output is
> mandatory, and an
> explanation what is wrong with the output file (assuming there is
> one).
What is wrong? This is what is wrong, and I've posted it:
frame= 6 fps= 2 q=0.0 size= 0kB time=00:00:00.00 bitrate= 0.0kbits/
s dup=0 drop=1238
frame= 7 fps= 2 q=0.0 size= 0kB time=00:00:00.00 bitrate= 0.0kbits/
s dup=0 drop=1487
frame= 7 fps= 2 q=-1.0 L size= 1109kB time=00:01:01.47 bitrate=
147.8kbits/s dup=0 drop=1531
It drops a lot of video frames, leaving only few (two or three). And I
believe it occurs in the decoder, not in the encoder.
If it can help, I'm posting the full output at the bottom of this
message.
> -r 25 might fix your problem.
Really it does, but now the question is how to define the source frame
rate? Or should I always encode with 25 fps? What had you in mind
exactly?
I've supposed that FLV decoder gets incorrect frame rate from the
container, therefore I've parsed FLV structure for some first video/
audio blocks for both "valid" and "invalid" files. "Invalid" means
that file which requires -r 25 explicit parameter to work. "Valid"
file works without this parameter. Valid file is a portion of the
"invalid" one from the second keyframe up to the end of file.
You can see both listings at the end of this message.
Here a links:
"Invalid" FLV file:
http://home.bokovikov.com/ffmpeg/test.flv
Invalid result is here:
http://home.bokovikov.com/ffmpeg/test.m4v
Valid version is here
http://home.bokovikov.com/ffmpeg/test2.flv
Valid result is here:
http://home.bokovikov.com/ffmpeg/test2.m4v
> Please do not high-jack threads, it is considered highly rude
When I did it? Or is this just your signature?...
Thanks.
Here is the whole output without -r 25 (when error exists):
ffmpeg version N-35462-g61b1d85, Copyright (c) 2000-2011 the FFmpeg
developers
built on Dec 7 2011 17:25:26 with gcc 4.0.1 (Apple Inc. build 5493)
configuration: --enable-static --enable-memalign-hack --enable-gpl
--enable-libx264 --disable-doc --disable-ffserver --disable-ffplay --
disable-ffprobe --enable-pthreads --enable-runtime-cpudetect --disable-
network --disable-shared --disable-filters --disable-decoders --
disable-encoders --disable-muxers --disable-demuxers --disable-parsers
--disable-bsfs --disable-protocols --disable-devices --enable-
filter=crop --enable-filter=scale --enable-protocol=file --enable-
decoder=aac --enable-decoder=h263 --enable-decoder=flv --enable-
decoder=vp6f --enable-decoder=vp6a --enable-decoder=h264 --enable-
decoder=nellymoser --enable-decoder=mp3 --enable-encoder=libx264 --
enable-encoder=flv --enable-encoder=aac --enable-parser=h264 --enable-
parser=mpegaudio --enable-demuxer=flv --enable-muxer=ipod --enable-
muxer=mp4 --enable-demuxer=mp4 --enable-encoder=mjpeg --enable-
demuxer=mov --enable-muxer=mjpeg
libavutil 51. 30. 0 / 51. 30. 0
libavcodec 53. 40. 0 / 53. 40. 0
libavformat 53. 24. 0 / 53. 24. 0
libavdevice 53. 4. 0 / 53. 4. 0
libavfilter 2. 51. 0 / 2. 51. 0
libswscale 2. 1. 0 / 2. 1. 0
libpostproc 51. 2. 0 / 51. 2. 0
Seems stream 0 codec frame rate differs from container frame rate:
50.00 (50/1) -> 0.08 (1/12)
Input #0, flv, from 'test.flv':
Metadata:
totalduration : 61
starttime : 0
lastkeyframetimestamp: 60
lasttimestamp : 61
canseekontime : true
canseektoend : true
hasvideo : true
hasaudio : true
datasize : 630
bytelength : 7271438
author :
copyright :
title :
rating :
metadatacreator :
Duration: 00:01:01.49, start: 0.006000, bitrate: 945 kb/s
Stream #0:0: Video: h264 (Baseline), yuv420p, 720x432 [SAR 1:1
DAR 5:3], 819 kb/s, 0.08 tbr, 1k tbn, 50 tbc
Stream #0:1: Audio: aac, 48000 Hz, stereo, s16, 131 kb/s
[buffer @ 0x601520] w:720 h:432 pixfmt:yuv420p tb:1/1000000 sar:1/1
sws_param:
[libx264 @ 0x81ce20] using SAR=1/1
[libx264 @ 0x81ce20] using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
[libx264 @ 0x81ce20] VBV buffer size cannot be smaller than one frame,
using 119999 kbit
[libx264 @ 0x81ce20] profile Constrained Baseline, level 3.0
[libx264 @ 0x81ce20] 264 - core 119 - H.264/MPEG-4 AVC codec -
Copyleft 2003-2011 - http://www.videolan.org/x264.html - options:
cabac=0 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1
psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1
8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2
threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0
bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250
keyint_min=1 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf
mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4
vbv_maxrate=10000 vbv_bufsize=119999 crf_max=0.0 nal_hrd=none
ip_ratio=1.40 aq=1:1.00
Output #0, ipod, to 'test.m4v':
Metadata:
totalduration : 61
starttime : 0
lastkeyframetimestamp: 60
lasttimestamp : 61
canseekontime : true
canseektoend : true
hasvideo : true
hasaudio : true
datasize : 630
bytelength : 7271438
author :
copyright :
title :
rating :
metadatacreator :
encoder : Lavf53.24.0
Stream #0:0: Video: h264 (avc1 / 0x31637661), yuv420p, 720x432
[SAR 1:1 DAR 5:3], q=-1--1, 1 tbn, 0.08 tbc
Stream #0:1: Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo,
131 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (h264 -> libx264)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[libx264 @ 0x81ce20] VBV buffer size cannot be smaller than one frame,
using 119999 kbit
frame= 6 fps= 2 q=0.0 size= 0kB time=00:00:00.00 bitrate=
0.0kbits/s dup=0 drop=1207 frame= 6 fps= 2 q=0.0 size= 0kB
time=00:00:00.00 bitrate= 0.0kbits/s dup=0 drop=1448 frame= 7
fps= 2 q=-1.0 Lsize= 1109kB time=00:01:01.47 bitrate= 147.8kbits/s
dup=0 drop=1531
video:122kB audio:959kB global headers:0kB muxing overhead 2.553527%
[libx264 @ 0x81ce20] frame I:4 Avg QP: 9.44 size: 23737
[libx264 @ 0x81ce20] frame P:3 Avg QP: 8.35 size: 9727
[libx264 @ 0x81ce20] mb I I16..4: 51.6% 0.0% 48.4%
[libx264 @ 0x81ce20] mb P I16..4: 46.7% 0.0% 17.6% P16..4: 12.4%
1.6% 0.7% 0.0% 0.0% skip:21.0%
[libx264 @ 0x81ce20] coded y,uvDC,uvAC intra: 47.0% 62.6% 48.6% inter:
7.9% 32.6% 11.0%
[libx264 @ 0x81ce20] i16 v,h,dc,p: 70% 16% 9% 5%
[libx264 @ 0x81ce20] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 23% 30% 13% 5%
5% 5% 6% 4% 8%
[libx264 @ 0x81ce20] i8c dc,h,v,p: 54% 23% 17% 7%
[libx264 @ 0x81ce20] kb/s:11.82
And here is the whole output with -r 25 being added:
ffmpeg version N-35462-g61b1d85, Copyright (c) 2000-2011 the FFmpeg
developers
built on Dec 7 2011 17:25:26 with gcc 4.0.1 (Apple Inc. build 5493)
configuration: --enable-static --enable-memalign-hack --enable-gpl
--enable-libx264 --disable-doc --disable-ffserver --disable-ffplay --
disable-ffprobe --enable-pthreads --enable-runtime-cpudetect --disable-
network --disable-shared --disable-filters --disable-decoders --
disable-encoders --disable-muxers --disable-demuxers --disable-parsers
--disable-bsfs --disable-protocols --disable-devices --enable-
filter=crop --enable-filter=scale --enable-protocol=file --enable-
decoder=aac --enable-decoder=h263 --enable-decoder=flv --enable-
decoder=vp6f --enable-decoder=vp6a --enable-decoder=h264 --enable-
decoder=nellymoser --enable-decoder=mp3 --enable-encoder=libx264 --
enable-encoder=flv --enable-encoder=aac --enable-parser=h264 --enable-
parser=mpegaudio --enable-demuxer=flv --enable-muxer=ipod --enable-
muxer=mp4 --enable-demuxer=mp4 --enable-encoder=mjpeg --enable-
demuxer=mov --enable-muxer=mjpeg
libavutil 51. 30. 0 / 51. 30. 0
libavcodec 53. 40. 0 / 53. 40. 0
libavformat 53. 24. 0 / 53. 24. 0
libavdevice 53. 4. 0 / 53. 4. 0
libavfilter 2. 51. 0 / 2. 51. 0
libswscale 2. 1. 0 / 2. 1. 0
libpostproc 51. 2. 0 / 51. 2. 0
Seems stream 0 codec frame rate differs from container frame rate:
50.00 (50/1) -> 0.08 (1/12)
Input #0, flv, from 'test.flv':
Metadata:
totalduration : 61
starttime : 0
lastkeyframetimestamp: 60
lasttimestamp : 61
canseekontime : true
canseektoend : true
hasvideo : true
hasaudio : true
datasize : 630
bytelength : 7271438
author :
copyright :
title :
rating :
metadatacreator :
Duration: 00:01:01.49, start: 0.006000, bitrate: 945 kb/s
Stream #0:0: Video: h264 (Baseline), yuv420p, 720x432 [SAR 1:1
DAR 5:3], 819 kb/s, 0.08 tbr, 1k tbn, 50 tbc
Stream #0:1: Audio: aac, 48000 Hz, stereo, s16, 131 kb/s
[buffer @ 0x60c920] w:720 h:432 pixfmt:yuv420p tb:1/1000000 sar:1/1
sws_param:
[libx264 @ 0x81ce20] using SAR=1/1
[libx264 @ 0x81ce20] using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
[libx264 @ 0x81ce20] profile Constrained Baseline, level 3.0
[libx264 @ 0x81ce20] 264 - core 119 - H.264/MPEG-4 AVC codec -
Copyleft 2003-2011 - http://www.videolan.org/x264.html - options:
cabac=0 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1
psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1
8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2
threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0
bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250
keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf
mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4
vbv_maxrate=10000 vbv_bufsize=10000 crf_max=0.0 nal_hrd=none
ip_ratio=1.40 aq=1:1.00
Output #0, ipod, to 'test.m4v':
Metadata:
totalduration : 61
starttime : 0
lastkeyframetimestamp: 60
lasttimestamp : 61
canseekontime : true
canseektoend : true
hasvideo : true
hasaudio : true
datasize : 630
bytelength : 7271438
author :
copyright :
title :
rating :
metadatacreator :
encoder : Lavf53.24.0
Stream #0:0: Video: h264 (avc1 / 0x31637661), yuv420p, 720x432
[SAR 1:1 DAR 5:3], q=-1--1, 25 tbn, 25 tbc
Stream #0:1: Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo,
131 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (h264 -> libx264)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 1538 fps= 43 q=-1.0 Lsize= 5615kB time=00:01:01.47 bitrate=
748.2kbits/s
video:4605kB audio:959kB global headers:0kB muxing overhead 0.899401%
[libx264 @ 0x81ce20] frame I:7 Avg QP:16.55 size: 12656
[libx264 @ 0x81ce20] frame P:1531 Avg QP:21.47 size: 3022
[libx264 @ 0x81ce20] mb I I16..4: 63.5% 0.0% 36.5%
[libx264 @ 0x81ce20] mb P I16..4: 9.4% 0.0% 1.5% P16..4: 34.2%
5.5% 1.3% 0.0% 0.0% skip:48.1%
[libx264 @ 0x81ce20] coded y,uvDC,uvAC intra: 12.5% 55.8% 7.6% inter:
7.3% 26.4% 0.5%
[libx264 @ 0x81ce20] i16 v,h,dc,p: 48% 23% 13% 16%
[libx264 @ 0x81ce20] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19% 25% 28% 4%
6% 5% 5% 3% 4%
[libx264 @ 0x81ce20] i8c dc,h,v,p: 57% 21% 17% 5%
[libx264 @ 0x81ce20] ref P L0: 82.1% 12.0% 5.8%
[libx264 @ 0x81ce20] kb/s:613.16
FLV file listings:
Columns meaning:
1 - time (ms)
2 - block type (8-audio, 9-video)
3 - composition time stamp (see AVC spec)
4 - frame size (bytes)
5 - 1=key frame 0=inter frame
6 - 1=configuration record frame
"Invalid" file listing:
0 8 4 1 1
0 9 55 1 1
0 9 40 9887 1 0
6 8 344 1 0
27 8 323 1 0
40 9 40 2860 0 0
49 8 379 1 0
70 8 329 1 0
80 9 40 2172 0 0
91 8 339 1 0
113 8 337 1 0
120 9 40 2464 0 0
134 8 345 1 0
155 8 348 1 0
160 9 40 2690 0 0
177 8 378 1 0
198 8 312 1 0
200 9 40 3957 0 0
..............
Here is the "valid" file:
0 8 4 1 1
0 9 55 1 1
0 9 40 14721 1 0
19 8 321 1 0
40 9 40 3624 0 0
41 8 329 1 0
62 8 345 1 0
80 9 40 2956 0 0
83 8 356 1 0
105 8 341 1 0
120 9 40 2396 0 0
126 8 353 1 0
147 8 324 1 0
160 9 40 2341 0 0
169 8 360 1 0
190 8 319 1 0
200 9 40 2549 0 0
More information about the ffmpeg-user
mailing list