FFmpeg Dropping JPEG Frames

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

FFmpeg Dropping JPEG Frames

Andrew Ayre
Hi,

I'm trying to convert a collection of JPEG frames into a H264/MP4 video.
  This works except some of the initial JPEGs are dropped and I'm not
sure why. Typically 40 are dropped.

I have a set of JPEGs numbered 0001.jpg to 0100.jpg. I'm using FFmpeg
SVN-r23392. Here is my command line:

ffmpeg -i %04d.jpg -r 15 -s hd1080 -vcodec libx264 -vpre hq -bf 0 -crf
16 stars_1080p.mp4

The video I get is four seconds long. 4 x 15FPS = 60 frames. So 40 are
dropped. Strangely however in the output FFmpeg appears to only reach
frame 60 and some frame numbers are duplicated.

I'm not that familiar with FFmpeg so I am probably doing something
silly. Any pointers are appreciated. Abbreviated output follows.

thanks, Andy

FFmpeg version SVN-r23392, Copyright (c) 2000-2010 the FFmpeg developers
   built on May 31 2010 12:54:58 with gcc 4.4.4
   configuration: --enable-gpl --enable-postproc --enable-pthreads
--enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libtheora
--enable-libx264 --enable-shared --enable-nonfree --enable-libvorbis
--enable-libgsm --enable-libspeex --enable-libschroedinger
--enable-libdirac --enable-avfilter --enable-avfilter-lavf
--enable-libopenjpeg --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-version3
   libavutil     50.16. 0 / 50.16. 0
   libavcodec    52.72. 0 / 52.72. 0
   libavformat   52.67. 0 / 52.67. 0
   libavdevice   52. 2. 0 / 52. 2. 0
   libavfilter    1.20. 0 /  1.20. 0
   libswscale     0.10. 0 /  0.10. 0
   libpostproc   51. 2. 0 / 51. 2. 0
Input #0, image2, from '%04d.jpg':
   Duration: 00:00:04.00, start: 0.000000, bitrate: N/A
     Stream #0.0: Video: mjpeg, yuvj422p, 3648x2048, 25 fps, 25 tbr, 25
tbn, 25 tbc
File 'stars_1080p.mp4' already exists. Overwrite ? [y/N] [scale @
0xa029780]w:3648 h:2048 fmt:yuvj422p -> w:1920 h:1080 fmt:yuv420p
flags:0xa0000004
[libx264 @ 0xa023f20]using cpu capabilities: MMX2 Cache32
[libx264 @ 0xa023f20]profile High, level 4.0
[libx264 @ 0xa023f20]264 - core 96 r1613 81e75e9 - H.264/MPEG-4 AVC
codec - Copyleft 2003-2010 - http://www.videolan.org/x264.html -
options: cabac=1 ref=4 deblock=1:0:0 analyse=0x3:0x113 me=umh subme=8
psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1
8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=1
sliced_threads=0 nr=0 decimate=1 interlaced=0 constrained_intra=0
bframes=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0
rc_lookahead=40 rc=crf mbtree=1 crf=16.0 qcomp=0.60 qpmin=10 qpmax=51
qpstep=4 ip_ratio=1.41 aq=1:1.00
Output #0, mp4, to 'stars_1080p.mp4':
   Metadata:
     encoder         : Lavf52.67.0
     Stream #0.0: Video: libx264, yuv420p, 1920x1080, q=10-51, 200 kb/s,
15 tbn, 15 tbc
Stream mapping:
   Stream #0.0 -> #0.0
Press [q] to stop encoding

frame=    2 fps=  1 q=17779864.5 size=       0kB time=10000000000.00
bitrate=
frame=    2 fps=  1 q=17779864.5 size=       0kB time=10000000000.00
bitrate=
frame=    3 fps=  1 q=11783320.5 size=       0kB time=10000000000.00
bitrate=
frame=    3 fps=  1 q=11783320.5 size=       0kB time=10000000000.00
bitrate=
frame=    4 fps=  1 q=5786776.5 size=       0kB time=10000000000.00
bitrate=   0
frame=    5 fps=  1 q=1002648.5 size=       0kB time=10000000000.00
bitrate=   0
frame=    5 fps=  1 q=1002648.5 size=       0kB time=10000000000.00
bitrate=   0
frame=    6 fps=  1 q=-4993895.5 size=       0kB time=10000000000.00
bitrate=
frame=    6 fps=  1 q=-4993895.5 size=       0kB time=10000000000.00
bitrate=
frame=    7 fps=  1 q=-10990439.5 size=       0kB time=10000000000.00
bitrate=
frame=    8 fps=  1 q=-16986983.5 size=       0kB time=10000000000.00
bitrate=
frame=    8 fps=  1 q=-16986983.5 size=       0kB time=10000000000.00
bitrate=
frame=    9 fps=  1 q=13414500.4 size=       0kB time=10000000000.00
bitrate=
frame=    9 fps=  1 q=13414500.4 size=       0kB time=10000000000.00
bitrate=
frame=   10 fps=  1 q=7417956.4 size=       0kB time=10000000000.00
bitrate=   0
frame=   11 fps=  1 q=1421412.4 size=       0kB time=10000000000.00
bitrate=   0

...

frame=   39 fps=  1 q=15508320.1 size=       0kB time=10000000000.00
bitrate=
frame=   39 fps=  1 q=15508320.1 size=       0kB time=10000000000.00
bitrate=
frame=   40 fps=  1 q=9511776.1 size=       0kB time=10000000000.00
bitrate=   0
frame=   41 fps=  1 q=21.0 size=      79kB time=0.07
bitrate=9760.9kbits/s dup=0
frame=   41 fps=  1 q=21.0 size=      79kB time=0.07
bitrate=9760.9kbits/s dup=0
frame=   42 fps=  1 q=21.0 size=     134kB time=0.13
bitrate=8203.6kbits/s dup=0
frame=   42 fps=  1 q=21.0 size=     134kB time=0.13
bitrate=8203.6kbits/s dup=0

...

frame=   60 fps=  0 q=21.0 size=    1009kB time=1.33
bitrate=6197.5kbits/s dup=0frame=   60 fps=  0 q=-1.0 Lsize=    2936kB
time=4.00 bitrate=6013.3kbits/s dup=0 drop=40
video:2935kB audio:0kB global headers:0kB muxing overhead 0.040693%
[libx264 @ 0xa023f20]frame I:2     Avg QP:13.22  size:137492
[libx264 @ 0xa023f20]frame P:58    Avg QP:14.74  size: 47066
[libx264 @ 0xa023f20]mb I  I16..4: 17.0% 67.9% 15.1%
[libx264 @ 0xa023f20]mb P  I16..4:  0.6%  0.4%  0.3%  P16..4: 40.8%
39.2% 15.6%  0.0%  0.0%    skip: 3.0%
[libx264 @ 0xa023f20]8x8 transform intra:56.8% inter:69.3%
[libx264 @ 0xa023f20]coded y,uvDC,uvAC intra: 87.5% 29.5% 18.6% inter:
34.0% 17.4% 0.3%
[libx264 @ 0xa023f20]i16 v,h,dc,p: 10% 11% 48% 31%
[libx264 @ 0xa023f20]i8 v,h,dc,ddl,ddr,vr,hd,vl,hu:  5%  4%  6% 15% 17%
13% 14% 13% 15%
[libx264 @ 0xa023f20]i4 v,h,dc,ddl,ddr,vr,hd,vl,hu:  4%  2%  3% 16% 16%
12% 13% 13% 20%
[libx264 @ 0xa023f20]i8c dc,h,v,p: 58% 37%  4%  1%
[libx264 @ 0xa023f20]Weighted P-Frames: Y:3.4%
[libx264 @ 0xa023f20]ref P L0: 40.0%  0.7% 25.8% 17.3% 15.6%  0.6%
[libx264 @ 0xa023f20]kb/s:6009.60

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: FFmpeg Dropping JPEG Frames

Phil Turmel
Hi Andrew,

On 06/06/2010 11:17 PM, Andrew Ayre wrote:

> Hi,
>
> I'm trying to convert a collection of JPEG frames into a H264/MP4 video.
>  This works except some of the initial JPEGs are dropped and I'm not
> sure why. Typically 40 are dropped.
>
> I have a set of JPEGs numbered 0001.jpg to 0100.jpg. I'm using FFmpeg
> SVN-r23392. Here is my command line:
>
> ffmpeg -i %04d.jpg -r 15 -s hd1080 -vcodec libx264 -vpre hq -bf 0 -crf
> 16 stars_1080p.mp4
>
> The video I get is four seconds long. 4 x 15FPS = 60 frames. So 40 are
> dropped. Strangely however in the output FFmpeg appears to only reach
> frame 60 and some frame numbers are duplicated.
>
> I'm not that familiar with FFmpeg so I am probably doing something
> silly. Any pointers are appreciated. Abbreviated output follows.

Not, silly, but yes, a common mistake:

> Input #0, image2, from '%04d.jpg':
>   Duration: 00:00:04.00, start: 0.000000, bitrate: N/A
>     Stream #0.0: Video: mjpeg, yuvj422p, 3648x2048, 25 fps, 25 tbr, 25
                                                      ^^^^^^
An image sequence is assumed to be 25 frames per second.  Your command line
then requests 15 frames per second output.  So FFmpeg drops frames from your
video to achieve the requested frame rate.

I think you need to put the "-r 15" in front of the "-i".  Options that
describe the input file must be given before the "-i" on the command line.

HTH,

Phil
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: FFmpeg Dropping JPEG Frames

Andrew Ayre
Hi Phil,

Thanks! That solved it. Now all the frames are included.

Andy

Phil Turmel wrote:

> Hi Andrew,
>
> On 06/06/2010 11:17 PM, Andrew Ayre wrote:
>> Hi,
>>
>> I'm trying to convert a collection of JPEG frames into a H264/MP4 video.
>>  This works except some of the initial JPEGs are dropped and I'm not
>> sure why. Typically 40 are dropped.
>>
>> I have a set of JPEGs numbered 0001.jpg to 0100.jpg. I'm using FFmpeg
>> SVN-r23392. Here is my command line:
>>
>> ffmpeg -i %04d.jpg -r 15 -s hd1080 -vcodec libx264 -vpre hq -bf 0 -crf
>> 16 stars_1080p.mp4
>>
>> The video I get is four seconds long. 4 x 15FPS = 60 frames. So 40 are
>> dropped. Strangely however in the output FFmpeg appears to only reach
>> frame 60 and some frame numbers are duplicated.
>>
>> I'm not that familiar with FFmpeg so I am probably doing something
>> silly. Any pointers are appreciated. Abbreviated output follows.
>
> Not, silly, but yes, a common mistake:
>
>> Input #0, image2, from '%04d.jpg':
>>   Duration: 00:00:04.00, start: 0.000000, bitrate: N/A
>>     Stream #0.0: Video: mjpeg, yuvj422p, 3648x2048, 25 fps, 25 tbr, 25
>                                                       ^^^^^^
> An image sequence is assumed to be 25 frames per second.  Your command line
> then requests 15 frames per second output.  So FFmpeg drops frames from your
> video to achieve the requested frame rate.
>
> I think you need to put the "-r 15" in front of the "-i".  Options that
> describe the input file must be given before the "-i" on the command line.


--
Andy
PGP Key ID: 0xDC1B5864
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-user