[FFmpeg-user] Convert just audio and preserve original video?
barsnick at gmx.net
Sun Apr 28 19:21:01 EEST 2019
On Sun, Apr 28, 2019 at 07:48:20 -0400, Ron Barnes wrote:
> I have a few movies and the Audio on them for some reason plays very,
> very low and I have to turn the volume on my TV to near max in order
> to hear.
Have you checked whether the volume on the audio track is actually low?
$ ffmpeg -i input -map 0:a -af volumedetect -f null -
> I have noticed that a separate video encoded with EAC3 works perfect.
As a side note, I have the same effect, because (E)AC3 gets passed on
to my TV by my media player, while other codecs are converted to PCM.
(My player isn't outputting as much volume as it could, apparently. Or
the TV has different internal "data paths".)
> I am trying to compile the correct line command to convert JUST the
> existing audio stream or streams (there may be multiple) to the above
> yet preserve all existing data such as Subtitles and video quality.
Yes, that's easy and I do it quite often:
$ ffmpeg -i input -map 0 -c copy -c:a ac3 output
"-map 0" tells ffmpeg to use all input streams, as you requested.
"-c copy" tells ffmpeg to not re-encode.
"-c:a ac3 tells ffmpeg to re-encode audio.
(You can replace "ac3" with "eac3" if you actually need EAC3.)
You may need to tweak the output audio bandwidth for quality using
"-b:a". I *believe* ac3/eac3 automatically uses 96 kBits/s per channel.
If, instead of going to a different codec, want to actually boost the
volume (probably a different use-case than yours), you would do:
$ ffmpeg -i input -map 0 -c copy -c:a aac -af volume=+6dB output
Note that this can lead to clipping if you boost more is technically
feasible. The volume filter tells you how much headroom you have. (I
believe there's a new soft-clip filter to avoid all too heard clipping
effects.) If only some audio segments are too silent, while some are okay,
the dynaudnorm filter is also very helpful.
More information about the ffmpeg-user