[Libav-user] Segmenting using pipe
Carl Lindqvist
lulebo at gmail.com
Mon Apr 8 17:31:59 CEST 2013
Hello
I have been experimenting with encoding a single file and removing parts of
the stream. I need this function when encoding material with breaks for
commercials to remove bars and other funky stuff and sync with the
subtitles.
I have done some tests with piping (windows), and I can get this to work
pretty well for two arbitrary segments as an example:
(ffmpeg -i inputfile.mp4 -ss 00:10:00 -t 60 -bsf h264_mp4toannexb -vcodec
copy -acodec copy -f mpegts -
ffmpeg -i inputfile.mp4 -ss 00:20:00 -t 60 -bsf h264_mp4toannexb -vcodec
copy -acodec copy -f mpegts - )| ffmpeg -y -f mpegts -i - -c:v libx264
-preset veryfast -x264opts keyint=75:min-keyint=75:no-scenecut -b:v 704k
-minrate 704k -maxrate 704k -bufsize 1500k -profile:v baseline -aspect 16:9
-c:a libvo_aacenc -b:a 96k -ac 2 test.mp4
(this will create a two minute file from two different sections of the
input file)
The problem is the codec copying in the first parts. Since the timecodes
might begin in the middle of a GOP, the final ffmpeg will not know what to
do until the first I-frame shows up, so it just shows a freeze frame until
that happens.
There is a requirement of a fixed gop size of 3 secs for the final output
file, so I need to do the encoding again for the final step, no cat can be
used on segments.
Is there a good intermediate codec to decode to in the first step?
(Preferrably uncompressed to gain performance) I have found yuv4mpegvideo
but that only does video. I need the audio as well. Anyone got any smart
ideas?
/Carl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130408/3dc2abf4/attachment.html>
More information about the Libav-user
mailing list