[FFmpeg-user] Input 5.1 DTS, output 2.0 MP3: Atrocious Quality

Bazza lamia at jeack.com.au
Sat May 16 07:30:41 CEST 2015

On Fri, 15 May 2015 23:04:06 -0500, John L <orionfyre at hotmail.com>

>Backstory: I have a system in place to automagically convert video files to smaller formats/versions on request to have a sort of "mobile version" for my father who travels extensively. The purpose is so that he can fit significantly more videos on his tablet than if they were the high quality rips.
>It all boils down to:
>ffmpeg -i [input-file] -ac 2 -c:v libx264 -c:a libmp3lame -b:v 1024k -preset fast [output-file]
>I was under the impression everything was hunky dory until I took a bunch of the shrunken movies on my phone on a roadtrip. A good many of the videos were as good as can be expected, and nothing was egregiously wrong. However on a few videos the audio was absolutely atrocious, blown out, clipping, and just noise from seemingly nowhere. 
>One of the worst was Intersteller which was completely unwatchable after the first two minutes with all the blown out crescendos, pops, cracks, static, and voices of the deep adulterating the audio stream. All video files affected by this were 5.1DTS sources, but not all 5.1DTS were affected.
>When talking with my father he said it was a frequent enough occurrence that he suspected it was just because I had shrunk the file so small and was an artifact of that. He did confirm that most videos that were affected weren't as bad as the Interstellar conversion.
>~/testing$ ffmpeg -version
>ffmpeg version 2.5.6-0ubuntu0.15.04.1 Copyright (c) 2000-2015 the FFmpeg developers
>built with gcc 4.9.2 (Ubuntu 4.9.2-10ubuntu13)
>configuration: --prefix=/usr --extra-version=0ubuntu0.15.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --shlibdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --enable-shared --disable-stripping --enable-avresample --enable-avisynth --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libshine --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libwavpack --enable-libwebp --enable-lib
> xvid --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzvbi --enable-libzmq --enable-frei0r --enable-libvpx --enable-libx264 --enable-libsoxr --enable-gnut
> ls --enable-openal --enable-libopencv --enable-librtmp --enable-libx265
>libavutil      54. 15.100 / 54. 15.100
>libavcodec     56. 13.100 / 56. 13.100
>libavformat    56. 15.102 / 56. 15.102
>libavdevice    56.  3.100 / 56.  3.100
>libavfilter     5.  2.103 /  5.  2.103
>libavresample   2.  1.  0 /  2.  1.  0
>libswscale      3.  1.101 /  3.  1.101
>libswresample   1.  1.100 /  1.  1.100
>libpostproc    53.  3.100 / 53.  3.100
>To troubleshoot I copied out a particularly bad snippet of audio
>ffmpeg -i Int*.mkv -vn -c copy -ss 1:30 -t 0:30 inter.dts

Yes. That snippet has about 6 tracks. 
Some of them are clipping (all on their own).

>This audio clip is confirmed to be a good 5.1dts stream

Good? Well OK -)

>ffmpeg -i inter.dts -ac 2 -c libmp3lame inter-test.mp3
>This audio sample has the exact same audio defects as in the shrunken video 

Correct. All tracks (some of which had reached maximum encodable
levels) are now being added/summed into 1 single (now) overloaded

Instead, take the 5.1 and _DOWNMIX_ all tracks to a single stereo for
the phone/tablet by declaring -acodec xxxx -ac 2. No intermediate
steps should be required. Consider also - Do you need pcm_s32le ?
pcm_s16le is usual.


More information about the ffmpeg-user mailing list