Archived from the Transloadit support forum. Originally posted on October 30, 2013; details may be outdated, see our docs for current behavior. Original thread
We’re trying to create a template for to transcode and segment multiple variants of a file for HLS streaming and we’re having a hard time getting the segments to be an average size. It appears that the key frames are being generated at scene changes rather than on regular intervals. This results in segment sizes that are all over the map because segments always start on a key frame.
Here is an example of an FFMpeg command that we have used to transcode a file with a key frame every second.
ffmpeg -i source.mov -vcodec libx264 -vb 900k -s 640x360 -r 29.97 -g 30 -profile:v main -acodec aac -ab 96k -ar 48000 -ac 2 -strict -2 -f mpegts hls-main.ts
I’ve tried to duplicate this by passing parameters via to the ffmpeg object in my template, but I can’t seem to get it to respect the “-g 30” parameter.
Any suggestions on how to get this to work?
Thanks!