[FFmpeg-user] frame accurate durations

Dave Bevan dave.bevan at bbc.co.uk
Tue May 29 23:46:05 CEST 2012


On May 29, 2012, at 9:40 PM, Chris Vincze wrote:

> Hi there,
> 
> I'm trying to split up a quicktime to render over multiple machines for a later concatenation, and having trouble getting the sections to be the right length.
> 
> These are the command line inputs, splitting the quicktime into chunks of 9 frames (this is a test clip, the usual renders are longer)

>This can only be done this way if all frames are i-frames/keyframes. NON-All-Keyframe files you only can 'split' at 
>a i-frame/keyframe and often they are not a 'regular' intervals.
>Further your ffmpeg version is more than a year old.



You could decompress (-i input.mov), convert to v210 which is of course un-compressed and I-frame, then output to ffmpeg's pipe: pseudo-file, and pipe that to another ffmpeg, inputting from the pipe, then perform your -ss and -t, which by this point should be a stream of I-frames - meaning your timings should be properly honoured.



> 
> /usr/local/bin/ffmpeg -i 'input.mov' -ss 0.0 -t 0.36 -vcodec v210 -y 'output[0-8].mov'
> /usr/local/bin/ffmpeg -i 'input.mov' -ss 0.36 -t 0.36 -vcodec v210 -y 'output[9-17].mov'
> /usr/local/bin/ffmpeg -i 'input.mov' -ss 0.72 -t 0.36 -vcodec v210 -y 'output[18-26].mov'
> /usr/local/bin/ffmpeg -i 'input.mov' -ss 1.08 -t 0.36 -vcodec v210 -y 'output[27-35].mov'
> etc
> 
> The start time is defined as: start_frame/framerate, so in this case 0/25, 9/25 18/25, etc... and the duration (t) is chunk_size/framerate, ie 9/25. (all calculations done as float).
> 
> The input clip here is h264, output uncompressed v210.
> 
> Some of the resulting sections are the right length, but some are one frame shorter, which produces jumps when concatenating them.
> 
> Below is the terminal output from one of the inaccurate length clips.
> 
> Is there a better way of being more accurate with the duration or is this a limitation inherent in ffmpeg?
> 
> 
> Many thanks
> 
> Chris
> 
> 
> 
> 
> FFmpeg version git-916dee9, Copyright (c) 2000-2011 the FFmpeg developers
>  built on Feb 14 2011 12:37:03 with gcc 4.2.1 (Apple Inc. build 5666) (dot 3)
>  configuration:
>  libavutil    50. 37. 0 / 50. 37. 0
>  libavcore     0. 16. 1 /  0. 16. 1
>  libavcodec   52.112. 1 / 52.112. 1
>  libavformat  52. 99. 1 / 52. 99. 1
>  libavdevice  52.  2. 3 / 52.  2. 3
>  libavfilter   1. 75. 0 /  1. 75. 0
>  libswscale    0. 12. 0 /  0. 12. 0
> [mov,mp4,m4a,3gp,3g2,mj2 @ 0x10100b000] Could not find codec parameters (Data: tmcd / 0x64636D74, 0 kb/s)
> 
> Seems stream 0 codec frame rate differs from container frame rate: 5000.00 (5000/1) -> 25.00 (25/1)
> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/mpc/lot1/DataLab/docs/software/test_material/QT/FRAME_NO_h264.mov':
>  Metadata:
>    major_brand     : qt
>    minor_version   : 537199360
>    compatible_brands: qt
>    creation_time   : 2012-05-29 11:04:48
>  Duration: 00:00:04.00, start: 0.000000, bitrate: 449 kb/s
>    Stream #0.0(eng): Video: h264 (Main), yuv420p, 1920x1080, 438 kb/s, 25 fps, 25 tbr, 2500 tbn, 5k tbc
>    Metadata:
>      creation_time   : 2012-05-29 11:04:48
>    Stream #0.1(eng): Data: tmcd / 0x64636D74, 0 kb/s
>    Metadata:
>      creation_time   : 2012-05-29 11:04:56
> [buffer @ 0x100c03ea0] w:1920 h:1080 pixfmt:yuv420p
> [ffsink @ 0x100c040e0] auto-inserting filter 'auto-inserted scaler 0' between the filter 'src' and the filter 'out'
> [scale @ 0x100c04310] w:1920 h:1080 fmt:yuv420p -> w:1920 h:1080 fmt:yuv422p16le flags:0xa0000004
> [v210 @ 0x101023e00] bits per raw sample: 0 != 10-bit
> Output #0, mov, to '/mpc/lot1/DataLab/docs/software/test_material/QT/05-29_000_SZ[9-17].mov':
>  Metadata:
>    major_brand     : qt
>    minor_version   : 537199360
>    compatible_brands: qt
>    creation_time   : 2012-05-29 11:04:48
>    encoder         : Lavf52.99.1
>    Stream #0.0(eng): Video: v210, yuv422p16le, 1920x1080, q=2-31, 200 kb/s, 25 tbn, 25 tbc
>    Metadata:
>      creation_time   : 2012-05-29 11:04:48
> Stream mapping:
>  Stream #0.0 -> #0.0
> Press [q] to stop encoding
> [buffer @ 0x100c03ea0] Buffering several frames is not supported. Please consume all available frames before adding a new one.
> frame=    2 fps=  0 q=0.0 size=   10800kB time=0.08 bitrate=1105923.6kbits/s
> frame=    6 fps=  5 q=0.0 size=   32400kB time=0.24 bitrate=1105921.2kbits/s
>    Last message repeated 8 times
> frame=    8 fps=  4 q=0.0 Lsize=   43201kB time=0.32 bitrate=1105937.6kbits/s
> video:43200kB audio:0kB global headers:0kB muxing overhead 0.001596%
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user

http://www.bbc.co.uk/
This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated.
If you have received it in error, please delete it from your system.
Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately.
Please note that the BBC monitors e-mails sent or received.
Further communication will signify your consent to this.
					


More information about the ffmpeg-user mailing list