doc/faq: Update video joining examples

-same_quant is not designed to convert between quantizer scales, AFAIK.

Add example using concat protocol.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Lou Logan 2012-06-21 09:43:33 -08:00 committed by Michael Niedermayer
parent 87dced8074
commit cdb94139cc
1 changed files with 20 additions and 12 deletions

View File

@ -222,26 +222,34 @@ equally humble @code{copy} under Windows), and finally transcoding back to your
format of choice. format of choice.
@example @example
ffmpeg -i input1.avi -same_quant intermediate1.mpg ffmpeg -i input1.avi -qscale:v 1 intermediate1.mpg
ffmpeg -i input2.avi -same_quant intermediate2.mpg ffmpeg -i input2.avi -qscale:v 1 intermediate2.mpg
cat intermediate1.mpg intermediate2.mpg > intermediate_all.mpg cat intermediate1.mpg intermediate2.mpg > intermediate_all.mpg
ffmpeg -i intermediate_all.mpg -same_quant output.avi ffmpeg -i intermediate_all.mpg -qscale:v 2 output.avi
@end example @end example
Notice that you should either use @code{-same_quant} or set a reasonably high Additionally, you can use the @code{concat} protocol instead of @code{cat} or
bitrate for your intermediate and output files, if you want to preserve @code{copy} which will avoid creation of a potentially huge intermediate file.
video quality.
Also notice that you may avoid the huge intermediate files by taking advantage @example
of named pipes, should your platform support it: ffmpeg -i input1.avi -qscale:v 1 intermediate1.mpg
ffmpeg -i input2.avi -qscale:v 1 intermediate2.mpg
ffmpeg -i concat:"intermediate1.mpg|intermediate2.mpg" -c copy intermediate_all.mpg
ffmpeg -i intermediate_all.mpg -qscale:v 2 output.avi
@end example
Note that you may need to escape the character "|" which is special for many
shells.
Another option is usage of named pipes, should your platform support it:
@example @example
mkfifo intermediate1.mpg mkfifo intermediate1.mpg
mkfifo intermediate2.mpg mkfifo intermediate2.mpg
ffmpeg -i input1.avi -same_quant -y intermediate1.mpg < /dev/null & ffmpeg -i input1.avi -qscale:v 1 -y intermediate1.mpg < /dev/null &
ffmpeg -i input2.avi -same_quant -y intermediate2.mpg < /dev/null & ffmpeg -i input2.avi -qscale:v 1 -y intermediate2.mpg < /dev/null &
cat intermediate1.mpg intermediate2.mpg |\ cat intermediate1.mpg intermediate2.mpg |\
ffmpeg -f mpeg -i - -same_quant -c:v mpeg4 -acodec libmp3lame output.avi ffmpeg -f mpeg -i - -qscale:v 2 -c:v mpeg4 -acodec libmp3lame -q:a 4 output.avi
@end example @end example
Similarly, the yuv4mpegpipe format, and the raw video, raw audio codecs also Similarly, the yuv4mpegpipe format, and the raw video, raw audio codecs also
@ -268,7 +276,7 @@ cat temp1.a temp2.a > all.a &
cat temp1.v temp2.v > all.v & cat temp1.v temp2.v > all.v &
ffmpeg -f u16le -acodec pcm_s16le -ac 2 -ar 44100 -i all.a \ ffmpeg -f u16le -acodec pcm_s16le -ac 2 -ar 44100 -i all.a \
-f yuv4mpegpipe -i all.v \ -f yuv4mpegpipe -i all.v \
-same_quant -y output.flv -qscale:v 2 -y output.flv
rm temp[12].[av] all.[av] rm temp[12].[av] all.[av]
@end example @end example