Open djbclark opened 7 years ago
These links look possibly apropos:
Dual-pass mode requires two calls to the loudnorm filter, the first of which is for measurement. This command will print loudness stats to stderr as JSON, and create no output file. Of course, dual-pass normalization can be easily scripted.
ffmpeg -i in.wav -af loudnorm=I=-16:TP=-1.5:LRA=11:print_format=json -f null -
{
"input_i" : "-27.61",
"input_tp" : "-4.47",
"input_lra" : "18.06",
"input_thresh" : "-39.20",
"output_i" : "-16.58",
"output_tp" : "-1.50",
"output_lra" : "14.78",
"output_thresh" : "-27.71",
"normalization_type" : "dynamic",
"target_offset" : "0.58"
}
We can then use these stats to call FFmpeg for a second time. Supplying the filter with these stats allow it to make more intelligent normalization decisions, as well as normalize linearly if possible. This second pass creates the loudness normalized output file, and prints a human-readable stats summary to stderr.
ffmpeg -i in.wav -af loudnorm=I=-16:TP=-1.5:LRA=11:measured_I=-27.61:measured_LRA=18.06:measured_TP=-4.47:measured_thresh=-39.20:offset=0.58:linear=true:print_format=summary -ar 48k out.wav
Input Integrated: -27.5 LUFS
Input True Peak: -4.5 dBTP
Input LRA: 18.1 LU
Input Threshold: -39.2 LUFS
Output Integrated: -16.0 LUFS
Output True Peak: -1.5 dBTP
Output LRA: 14.6 LU
Output Threshold: -27.2 LUFS
Normalization Type: Dynamic
Target Offset: +0.0 LU
Filtering and streamcopy cannot be used together.
By default h265ize copys audio unmodified. By using loudnorm audio normalization you are telling ffmpeg to normalize (modify) but copy (don't modify) the audio. This is a bug with h265ize, h265ize should either present a warning about this or default to he audio. A quick fix is to use the --he-audio
flag. Otherwise I suggest running the ffmpeg command with your own audio settings (codec, bitrate, channels, etc.).
Hmm, so as you say --he-audio
does work. I was actually using --downmix-he-audio
originally but left it out for simplicity in the bug report; and that still doesn't work, same error as reported originally.
However --he-audio --downmix-he-audio
does work. So there is also a bug with --downmix-he-audio
since the doc says that option should enable he-audio:
--downmix-he-audio Downmix he-audio opus to Dolby Pro Logic II at 40
kbps/channel. Enables he-audio. [boolean] [default: false]
For safety I think I'm going to go with
--normalize-level 4 --he-audio --force-he-audio --downmix-he-audio
:-)
Thanks for the great software!
Hmm actually looking at the doc again I'm not sure what exactly the difference is between --he-audio
and --downmix-he-audio
... I think I may have read the doc too quickly and assumed downmix meant to stereo, and would take less room, but I guess they are both 40 kbs/sec, with downmix actually being from stereo to surround sound?
Dolby Pro Logic II transforms traditional stereo audio into 5.1-channel surround sound for a seamless listening experience full of presence and depth.
So --downmix-he-audio
seems like maybe a bit confusing, in that it is not a downmix from the --he-audio
option, but instead a possible downmix from some original 5.1 audio codec source, but actually aimed at 5.1 speaker setups? Or am I still confused?
Or tl;dr: If I am h265izing mono and stereo college lectures, which of the audio options should I use?
However --he-audio --downmix-he-audio does work. So there is also a bug with --downmix-he-audio since the doc says that option should enable he-audio:
Your right, that is another bug.
For safety I think I'm going to go with --normalize-level 4 --he-audio --force-he-audio --downmix-he-audio
--force-he-audio
doesn't do what I think you think it does. It encodes lossless streams, such as those encoded with flac, with the opus codec (something someone wouldn't want to do by accident (lose a lot of quality)).
Hmm actually looking at the doc again I'm not sure what exactly the difference is between --he-audio and --downmix-he-audio
--downmix-he-audio
downmixes any audio stream with more than 3 channels to 2 channel (ex. 7.1 surround -> Stereo). Videos that already have stereo or even mono audio will not be affected.
So --downmix-he-audio seems like maybe a bit confusing, in that it is not a downmix from the --he-audio option, but instead a possible downmix from some original 5.1 audio codec source, but actually aimed at 5.1 speaker setups? Or am I still confused?
DPLII is a stereo audio format that DPLII capable surround systems can efficiently upmix to 5.1. So If you start with a video that has 5.1 channel audio and want to reencode it to a file as small as possible you can use this DPLII "compression" scheme to bring that 5.1 down to stereo which can be brought back close to the original 5.1 during playback. Hopefully that makes sense.
Or tl;dr: If I am h265izing mono and stereo college lectures, which of the audio options should I use?
Just --he-audio
.
Thanks for the great software!
You're welcome!
Btw, just wanted to say thanks for the detailed bug report, usually don't see these.
Using Bleeding edge 0.5.0 2017-08-23 4:49pm EDT installed via
npm install FallingSnow/h265ize --global
Using sample media files from https://github.com/mediaelement/mediaelement-files
$ h265ize --normalize-level 4 --debug big_buck_bunny.mp4
The h265ize.log.txt doesn't look to have anything useful. The console output error is:
However I think that is also not useful, just complaining that a file it was expecting didn't exist because of ffmpeg failing. However if you manually run the ffmpeg command from the log
There seems to be one or two problems; if the logging is to be believed it looks like maybe there is a typo and it is running "ffmpeg" instead of "nice" with the error you'd expect from this mistake:
However stripping off the "ffmpeg -n 10" still leaves an error:
I've tried with both HEAD ffmpeg compiled from source and a ffmpeg static snapshot build, both separately and from within h265ize using:
export FFMPEG_PATH="/Applications/ffmpeg-static"
with the same results.Also
h265ize --version
seems to be broken, gives:But looking at it manually shows the latest 0.5.0 git seems to be installed: