[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: normalize audio in mp4s



Jonas Smedegaard wrote:

> Maybe your system simply treats multi-channel
> audio wrongly.
>
> A simpler alternative to recoding audio with
> fine-tuned values could be something like this to
> force use only stereo:
>
>   mpv --audio-channels=stereo ...

Yes, I've done that, in ~/.config/mpv/mpv.conf [1]

  audio-channels=stereo

that makes me wonder, what happens if one has that _and_
downmixes as suggested? [last] is a/the zsh downmix
wrapper around ffmpeg, that has worked to some extent.

But, not to all extent :(

Today I got this [3], checking with mm-audio [same file as
mm-downmix below, line 20] as I always do since
I learned of the 2 or 5.1 (6) channels, it reports

  $ mm-audio blade-runner-2049.avi
  blade-runner-2049.avi: Stream #0:1: Audio: ac3 ([0]
  [0][0] / 0x2000), 48000 Hz, 5.1(side), fltp, 384 kb/s
  6: L R C LFE Ls Rs

unfortunately

  $ mm-downmix
  Could not write header for output file #0 (incorrect codec parameters ?): Operation not permitted
  Error initializing output stream 0:1 -- 
  Conversion failed!

with

  $ file blade-runner-2049.avi
  blade-runner-2049.avi: RIFF (little-endian) data, AVI,
  720 x 304, 23.98 fps, video: XviD, audio: Dolby AC3 (6
  channels, 48000 Hz)

So I think it is the avi file format that it/something
cannot handle?

In this file, the speech is so weak and the wrestling,
arguing, and shooting (or whatever on Earth they are
doing) so strong, putting bass to -5 and trebl to +5 on
the stereo and turning down the volume in mpv still
doesn't do it, it's too loud when shooting while barely
audible when talking.

I'm starting to think, can this be my ears? :O Or is
this a common situation?

Feel free to get the file and tell me, that'd be much
appreciated...

But apart from that, what can one do to downmix avi
files, if that is indeed what causes the sudden
malfunction of the command?


#! /bin/zsh

# https://dataswamp.org/~incal/conf/.zsh/audio-norm

mm-downmix () {
    local files=($@)

    local name
    local ext
    local out
    for f in $files; do
        name=${f:r}
        ext=${f:e}
        out=${name}-stereo.${ext}

        ffmpeg -y           \
               -i $f        \
               -map 0:0     \
               -map 0:1     \
               -c:v copy    \
               -strict -2   \
               -c:a libopus \
               -b:a 128k    \
               -ac 2        \
               -clev 1.414  \
               -slev 0.5    $out
    done
}


[1] <https://dataswamp.org/~incal/conf/mpv/mpv.conf>,
    also,
    <https://dataswamp.org/~incal/conf/mpv/input.conf>
    feel free to page thru it and see if it makes sense,
    send a private mail if you think it is off-topic
    here for some reason :) I have not been using mpv
    for a very long time but it seems a big improvemt,
    no doubt.

[2] https://dataswamp.org/~incal/conf/.zsh/audio-norm

[3] https://pirateproxy.ink/torrent/19465184/Blade_Runner_2049.HDRip.XviD.AC3-EVO

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal


Reply to: