[FFmpeg-user] How to get compatible encoding when converting various sources?

Hans Georg Schaathun georg+ffmpeg at schaathun.net
Wed Apr 2 19:36:08 CEST 2014


I try to create videos by recording small snippets, with different
methods, and then splice them together to a longer video.  Problem
is, even using the same output codec options, the snippets appear
not to be compatible.  The voice in some of the snippets are in
a deeper pitch in the spliced video compared to the constituent 

Does anyone have any advice to offer?

I am not an expert in multimedia coding, least of all sound.
I can guess that there is probably some incompatibility in the
sound encoding, but I cannot imagine what options are missing
to force it all into one format.

The source files are generated with the following two ffmpeg
1.  From a high quality AVI file, recorded by ffmpeg from screencast:
ffmpeg -i in.avi -acodec libfdk_aac -ab 128k -ac 2 \
	-vcodec libx264 -s 640x480 -pix_fmt yuv420p -movflags \
	-threads 0 -y out.mp4
2.  From a PNG still and a FLAC file recorded by audacity:
ffmpeg -loop 1 -i in.png -i in.flac \
	-acodec libfdk_aac -ab 128k -ac 2 \
	-vcodec libx264 -s 640x480 -pix_fmt yuv420p -movflags \
        -shortest -threads 0 -y out.mp4

The results are spliced with the following command
        ffmpeg -f concat -i in.list -c copy out.mp4

In the cases where all the snippets are from source 1, there is
no problem.  When the first snippet is from source 2, all the snippets 
from source 1 get the deranged audio pitch.  (I have not tried 
combining a starting source 1 with subsequent source 2-s.)

I am also doing the same exercise using OGG/Theora/Vorbis
instead of mpeg4/h264/aac, but the result is even worse,
with sound clipping.

I shall be grateful for any pointers.

If it matters, it runs on Ubuntu 13.04 with the following version 
% ffmpeg -version
ffmpeg version git-2013-08-28-70106e7
built on Aug 28 2013 11:27:12 with gcc 4.7 (Ubuntu/Linaro
configuration: --prefix=/local/home/georg/prg/ffmpeg
--extra-ldflags=-L/local/home/georg/prg/ffmpeg/lib --extra-libs=-ldl
--enable-gpl --enable-libass --enable-libfdk-aac --enable-libmp3lame
--enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx
--enable-libx264 --enable-nonfree --enable-x11grab
libavutil      52. 42.100 / 52. 42.100
libavcodec     55. 29.100 / 55. 29.100
libavformat    55. 14.102 / 55. 14.102
libavdevice    55.  3.100 / 55.  3.100
libavfilter     3. 82.102 /  3. 82.102
libswscale      2.  5.100 /  2.  5.100
libswresample   0. 17.103 /  0. 17.103
libpostproc    52.  3.100 / 52.  3.100

:-- Hans Georg

More information about the ffmpeg-user mailing list