John L wrote:
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-libxvid
--enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883
--enable-libzvbi --enable-libzmq --enable-frei0r --enable-libvpx
--enable-libx264 --enable-libsoxr --enable-gn
ut
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
This audio clip is confirmed to be a good 5.1dts stream
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
Converting it to a stereo wave format, and then converting into an mp3:
ffmpeg -i inter.dts -ac 2 -c pcm_s32le inter.wav && ffmpeg -i inter.wav -c
libmp3lame inter.mp3
both inter.wav and inter.mp3 are confirmed to be GOOD stereo copies of the
audio with no defects.
https://www.dropbox.com/s/tru46zo07gcr8ve/testing.tar.gz?dl=0
This is a link to the files in question to my testing above.
inter.dts : 30 second rip of audio from video
inter-test : dts->mp3 conversion
inter.mp3 : dts->wav->mp3 conversion
I apologize if I'm missing something glaring, but I've been unable to find any
other instances of this issue with my google-fu. Until I have a solution I've
already edited my services to perform this intermediary wave step work-around
on all conversions.
Thank you for your time.
If your target output file is .mp4 (no output type mentioned in your commands)
then
consider fdkaac, which many times produces smaller files than .mp3 + is stellar
quality + plays
anywhere an .mp4 file plays.
Downmixing from 5.1 to stereo is automagick.
To get .mp3 sized files use the he2 profile as with this snippet...
-c:a libfdk_aac -profile:a aac_he_v2 -afterburner 1 -signaling explicit_sbr
-vbr 5 -ac 2 -ar 44100
HE2 takes more CPU cycles than HE + produces far smaller files.
Another trick is using vbr encoding which also reduces file size.
_______________________________________________
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user