[FFmpeg-user] Fixed GOP length with force_key_frames option
delbin.wen at gmail.com
Mon Jan 5 05:29:53 CET 2015
I'm working on creating fixed length segment for adaptive streaming,
therefore I'd like each segment to be closed GOP and start with IDR. I
would like to keep FPS as same as source, and create fixed GOP
(length=2*FPS). If I know the source's FPS, it would be simple, like
ffmpeg -i source.ts -c:v libx264 -r 24000/1001 -g 48 output.mp4 (assume
source's FPS is 23.98)
* Could I achieve this without parsing source's FPS?
The source might be telecine, and therefore we need to IVTC to resotre
23.98 FPS from 59.94i source. In this case, we need to detect 1) if source
is telecine, and 2) which FPS should be appropriate. My goal is to have
single command to deal with all possible cases, progressive, interlaced,
and telecine. So I tried the command below:
ffmpeg -i source.ts -c:v libx264 -force_key_frames "expr:gte(t,n_forced"
-rc-lookahead 0 -x264opts stitchable:scenecut=0 -vf yadif (or
* So my question is could force_key_frames achieve fixed GOP length?
* If not, is there any alternative approach? Or, is option (-g) the only
way to do this?
More information about the ffmpeg-user