It looks like it's from ffmpeg's muxer. I guess you can use another mpeg2 muxer like mplex from mjpegtools
Code:"PATH\ffmpeg" -i %1 -map 0:0 -map 0:1 -c:v copy -an "copy.m2v" -vn -c:a copy "%~d1%~p1%~n1.mpa" "PATH\ffmpeg" -i %1 -f sox - | "PATH\sox" -t sox - -c 2 -r 48000 -b 16 --norm=-3 -t wav - | "PATH\ffmpeg" -i - -vn -c:a ac3 -b:a 128k "sox.ac3" "PATH\mplex" -o "%~d1%~p1%~n1.AC3.mpg" "copy.m2v" "sox.ac3" -f 3 del "copy.m2v" del "sox.ac3" "X:\Daves Folder\Sounds\VideoRedo Completed Sound Short.WAV" pause
+ Reply to Thread
Results 91 to 120 of 199
-
-
I ended up using norm=-7 for sox as that gave the same volume as 0 gain for AAC Gain. I opened 2 identical files in an audio editor and the waveforms were the same volume. There might be a better way of comparing the volume of 2 files but it worked for me!
There's no problem with using norm=-7 for sox is there?
I assume there's no non-destructive normalizer for AC3? -
-
There seems to be a problem with this Sox AC3 normalization method:
Code:"X:\Portable Installations\FFMPEG\bin\ffmpeg.exe" -i %1 -f sox - | "X:\Portable Installations\Sox\sox.exe" -t sox - -c 2 -r 48000 -b 16 --norm=-7 -t wav - | "X:\Portable Installations\FFMPEG\bin\ffmpeg.exe" -i - -vn -c:a ac3 -b:a 128k "output.ac3" "X:\Portable Installations\eac3to\eac3to.exe" %1 1:"video.h264" 2:"%~d1%~p1%~n1.ac3" REM Demux the video and audio from the source "X:\Portable Installations\MKV Toolnix\mkvmerge.exe" -o "%~d1%~p1%~n1.AC3.mkv" "--forced-track" "0:no" "-d" "0" "-A" "-S" "-T" "--no-global-tags" "--no-chapters" "(" "video.h264" ")" "--language" "0:eng" "--forced-track" "0:no" "-a" "0" "-D" "-S" "-T" "--no-global-tags" "--no-chapters" "(" "output.ac3" ")" "--track-order" "0:0,1:0" del video.h264 del output.ac3 del "video - Log.txt" pause
One of them was an AAC Gain 0 gain to AC3 conversion.
The other was an AC3 source normalized with Sox to norm=-7 to AC3 conversion. I'm not referring to the demuxed file which I know won't be normalized.
I then converted both to WAV and opened in an audio editor to compare the waveforms. They both look and sound the same volume.
However when I run the above AC3 script on the full 3 hour length video that the AC3 source came from, the audio is noticeably lower. It was my understanding that the volume should be raised or lowered by the script to get a similar result to the AAC Gain method? Any idea what the problem is?
I haven't uploaded the samples as it would be pointless unless I uploaded the full length video which is too big to upload. -
So it works ok on small 47 sec sample, but not as expected on full length 3hr video?
The explanation might be as simple as long video has large peaks that limit the normalization. The normalization algorithm is limited in such a way that prevents clipping (or if you set a dB value like -7, it limits peaks to that value) -
I don't believe so regarding large peaks as all the other races had the same volume on the source and they normalized fine with AAC Gain yet Sox lowers the volume quite a bit on an AC3 to AC3 conversion. Here's a screenshot of the source waveform for the long video source: https://docs.google.com/document/d/1OlFuehIssbrsiP3LltOs9JkehR5I7o43LyHAMulxGhc/edit
-
How much difference is there ? One explanation is -7 is lower than -3 . < no really
>
What does the RG version of the 3hr video sound like ?
They use different algorithms as well. I already mentioned that at the beginning
If you want exactly the same algorithm, there is a FLAC variation that supports RG. So encode to FLAC with RG, then to AC3 with a RG supported software . The reason for the FLAC intermediate is so you don't have compression losses in the intermediate step
eg. if I took your 1st mkv sample: (Pay attention to the mean volume (average volume) , and the max volume)
Original
[Parsed_volumedetect_0 @ 02d3a920] n_samples: 6062080
[Parsed_volumedetect_0 @ 02d3a920] mean_volume: -31.1 dB
[Parsed_volumedetect_0 @ 02d3a920] max_volume: -14.6 dB
[Parsed_volumedetect_0 @ 02d3a920] histogram_14db: 3
[Parsed_volumedetect_0 @ 02d3a920] histogram_15db: 56
[Parsed_volumedetect_0 @ 02d3a920] histogram_16db: 238
[Parsed_volumedetect_0 @ 02d3a920] histogram_17db: 807
[Parsed_volumedetect_0 @ 02d3a920] histogram_18db: 2276
[Parsed_volumedetect_0 @ 02d3a920] histogram_19db: 6009
AACGain
[Parsed_volumedetect_0 @ 02d3f3a0] mean_volume: -20.5 dB
[Parsed_volumedetect_0 @ 02d3f3a0] max_volume: -4.2 dB
[Parsed_volumedetect_0 @ 02d3f3a0] histogram_4db: 21
[Parsed_volumedetect_0 @ 02d3f3a0] histogram_5db: 124
[Parsed_volumedetect_0 @ 02d3f3a0] histogram_6db: 480
[Parsed_volumedetect_0 @ 02d3f3a0] histogram_7db: 1420
[Parsed_volumedetect_0 @ 02d3f3a0] histogram_8db: 4006
[Parsed_volumedetect_0 @ 02d3f3a0] histogram_9db: 9187
Sox -3 dB
[Parsed_volumedetect_0 @ 02d23d00] n_samples: 6064128
[Parsed_volumedetect_0 @ 02d23d00] mean_volume: -19.5 dB
[Parsed_volumedetect_0 @ 02d23d00] max_volume: -2.8 dB
[Parsed_volumedetect_0 @ 02d23d00] histogram_2db: 1
[Parsed_volumedetect_0 @ 02d23d00] histogram_3db: 23
[Parsed_volumedetect_0 @ 02d23d00] histogram_4db: 154
[Parsed_volumedetect_0 @ 02d23d00] histogram_5db: 533
[Parsed_volumedetect_0 @ 02d23d00] histogram_6db: 1520
[Parsed_volumedetect_0 @ 02d23d00] histogram_7db: 4114
Sox -7 dB
[Parsed_volumedetect_0 @ 02d23d00] n_samples: 6064128
[Parsed_volumedetect_0 @ 02d23d00] mean_volume: -23.4 dB
[Parsed_volumedetect_0 @ 02d23d00] max_volume: -7.1 dB
[Parsed_volumedetect_0 @ 02d23d00] histogram_7db: 26
[Parsed_volumedetect_0 @ 02d23d00] histogram_8db: 141
[Parsed_volumedetect_0 @ 02d23d00] histogram_9db: 531
[Parsed_volumedetect_0 @ 02d23d00] histogram_10db: 1501
[Parsed_volumedetect_0 @ 02d23d00] histogram_11db: 4165
Post the results on the ffmpeg volumedetect on the 3hr file. To print it out just add 2>text.txt (or whatever filename)
ffmpeg -i "input.ext" -vn -af "volumedetect" -f null NUL 2>text.txt -
Yeah I get that -7 is lower than -3! But I only lowered it to 7 because -3 was louder than AAC Gain 0 on the 45 second clip I tested.
http://pastebin.com/20jFdYbj -
Post the results on both versions of the same 3hr clip - The Sox version, and the AACGain derived version
EDIT: Or wait, this was an AC3 source? NM then
You can look at some of the sox switches (there are a lot in the documenatation), or maybe try the FLAC RG workaround if you like that algorithm better -
Yes the 3 hour video was from an AC3 source.
This is bizarre: -3 actually resulted in a quieter volume than -7: e: https://docs.google.com/document/d/1OlFuehIssbrsiP3LltOs9JkehR5I7o43LyHAMulxGhc/edit
Sox normalization doesn't seem to work properly. Could you possibly give me a script for the FLAC method please. By the time I figure out how to write the script properly, Bluray will be extinct...
It's still going to give me an AC3 file in MKV and give me a demuxed AC3 file isn't it ? -
What script for what exactly? For a video with AC3 source ? normalized with eac3to to -3db ?
The only negative is it takes longer (it's actually 3 passes, 2pass for normalization to 0dB , 1 more for decreasing to -3dB) and it takes longer anyways per pass). RG method (if it supported AC3 natively) would be about 5x faster for the normalization step (even more than that overall because you're encoding to AC3 as well, RG method doesn't actually re-encode) -
You could have probably figured this one out by yourself by now
Code:REM Demux the video and audio, Create separate normalized audio wav intermediate "X:\Portable Installations\eac3to\eac3to.exe" %1 1:"video.h264" 2:"%~d1%~p1%~n1.AC3" 2:"norm.wav" -normalize REM Encode to AC3 128kbps -3dB from the normalized value "X:\Portable Installations\eac3to\eac3to.exe" "norm.wav" "eac3to.ac3" -128 -3dB "X:\Portable Installations\MKV Toolnix\mkvmerge.exe" -o "%~d1%~p1%~n1.AC3.mkv" "--forced-track" "0:no" "-d" "0" "-A" "-S" "-T" "--no-global-tags" "--no-chapters" "(" "video.h264" ")" "--language" "0:eng" "--forced-track" "0:no" "-a" "0" "-D" "-S" "-T" "--no-global-tags" "--no-chapters" "(" "eac3to.ac3" ")" "--track-order" "0:0,1:0" del video.h264 del norm.wav del eac3to.ac3 del "video - Log.txt" del "eac3to - Log.txt" pause
Last edited by poisondeathray; 1st Aug 2014 at 17:40.
-
Unfortunately with the Eacto3 script I got the same results as the Sox script before, it doesn't seem to be working correctly.
I was wondering. I installed the AAC Codec from here in DB Poweramp: https://www.videohelp.com/tools/Nero-AAC-Codec . I noticed in the codec instructions (nothing to do with DB Poweramp) it says you can only convert from WAV, however I just used DB Poweramp to convert AC3 to AAC. What's going on?
Anyway, since I'm re-encoding anyway from AC3 to AAC, isn't there a script I could use (like you made before) to convert AC3 to AAC and then use AAC Gain on the AAC?
If not, then in a script can't I just convert AC3 to Wav then re-encode to AAC? Do you know of a script for that please? -
It suggests something is wrong with your file . Unlikely that 2 programs would fail . Try either script on another video, you will see it works
I was wondering. I installed the AAC Codec from here in DB Poweramp: https://www.videohelp.com/tools/Nero-AAC-Codec . I noticed in the codec instructions (nothing to do with DB Poweramp) it says you can only convert from WAV, however I just used DB Poweramp to convert AC3 to AAC. What's going on?
Anyway, since I'm re-encoding anyway from AC3 to AAC, isn't there a script I could use (like you made before) to convert AC3 to AAC and then use AAC Gain on the AAC?
If not, then in a script can't I just convert AC3 to Wav then re-encode to AAC? Do you know of a script for that please?
AAC isn't compatible with BD.
You can convert from AC3 to AAC directly
When you convert and re-encode between formats, it must be decoded first. This is true for both audio & video. When it's decoded, it's uncompressed. Whether or not a physical uncompressed PCM wave intermediate (or uncompressed video , for video) is present depends if the programs takes a few steps or if it frameserves or pipes -
I think you should be able to figure it out by now.
I would recommend you use a high bitrate AAC file if you're only using it to convert temporarily as an intermediate before converting to AC3 -
It seems to be the easiest thing to do. Thanks
Was wondering if it's possible to queue scripts as I've got several hundred videos I need to use my MKV AAC Normalization script on so I wanted to let the script run overnight.
This is the script I have just now but I have to select a file to run and it can only run one video at a time:
Code:"X:\Portable Installations\ffmpeg\bin\ffmpeg.exe" -i %1 -map 0:0 -map 0:1 -c:v copy -bsf:v h264_mp4toannexb -an "video.h264" -vn -c:a copy -absf aac_adtstoasc "gain.m4a" "X:\Portable Installations\AAC Gain 1.9\aacgain" -r -k -m 0 gain.m4a "X:\Portable Installations\ffmpeg\bin\ffmpeg.exe" -i gain.m4a -map 0:0 -vn -c:a copy "%~d1%~p1%~n1.aac" -map 0:0 -vn -c:a ac3 -b:a 128k "output.ac3" "X:\Portable Installations\MKV Toolnix\mkvmerge.exe" -o "%~d1%~p1%~n1.AC3.mkv" "--forced-track" "0:no" "-d" "0" "-A" "-S" "-T" "--no-global-tags" "--no-chapters" "(" "video.h264" ")" "--language" "0:eng" "--forced-track" "0:no" "-a" "0" "-D" "-S" "-T" "--no-global-tags" "--no-chapters" "(" "output.ac3" ")" "--track-order" "0:0,1:0" del gain.m4a del video.h264 del output.ac3 "X:\Daves Folder\Sounds\VideoRedo Completed Sound Short.WAV" pause
-
The easiest is probably adjust so it batches each file in a given directory serially. Just double click the bat file in the folder of files to process . This is from your first example, it will process all the MKV's in a directory. You would need to adapt it if source file is TS or something else
Code:for %%a in ("*.mkv") do ( "X:\Portable Installations\ffmpeg\bin\ffmpeg.exe" -i %%a -map 0:0 -map 0:1 -c:v copy -bsf:v h264_mp4toannexb -an "video.h264" -vn -c:a copy -absf aac_adtstoasc "gain.m4a" "X:\Portable Installations\AAC Gain 1.9\aacgain" -r -k -m 0 gain.m4a "X:\Portable Installations\ffmpeg\bin\ffmpeg.exe" -i gain.m4a -map 0:0 -vn -c:a copy "%%~da%%~pa%%~na.aac" -map 0:0 -vn -c:a ac3 -b:a 128k "output.ac3" "X:\Portable Installations\MKV Toolnix\mkvmerge.exe" -o "%%~da%%~pa%%~na.AC3.mkv" "--forced-track" "0:no" "-d" "0" "-A" "-S" "-T" "--no-global-tags" "--no-chapters" "(" "video.h264" ")" "--language" "0:eng" "--forced-track" "0:no" "-a" "0" "-D" "-S" "-T" "--no-global-tags" "--no-chapters" "(" "output.ac3" ")" "--track-order" "0:0,1:0" del gain.m4a del video.h264 del output.ac3 ) "X:\Daves Folder\Sounds\VideoRedo Completed Sound Short.WAV" pause
There are other ways to do more complex scripts with subroutines and conditionals, you can read about more advanced scripting when you have time
Serial one by one processing isn't always the best or fastest way to allocate resources - some processes are bottlenecks (eg. video encoding usually is CPU limited) and other processes might have slack time (wasted CPU cycles) eg. demuxing won't tax the CPU but might tax a single HDD. If you have several HDD's or SSD's , that's where you might split or divide certain processes up to get things done faster. But it's difficult to script or you have to customize to specific scenariosLast edited by poisondeathray; 2nd Aug 2014 at 23:52.
-
Thanks. Was wondering with this MPEG2 script you made for me, what would the script be without the normalization if I don't want to change the volume of my MPEG2?
Code:"X:\Portable Installations\ffmpeg\bin\ffmpeg.exe" -i %1 -map 0:0 -map 0:1 -c:v copy -an "copy.m2v" -vn -c:a copy "%~d1%~p1%~n1.mpa" "X:\Portable Installations\ffmpeg\bin\ffmpeg.exe" -i %1 -f sox - | "X:\Portable Installations\Sox\sox.exe" -t sox - -c 2 -r 48000 -b 16 --norm=-7 -t wav - | "X:\Portable Installations\ffmpeg\bin\ffmpeg.exe" -i - -vn -c:a ac3 -b:a 128k "sox.ac3" "X:\Portable Installations\MJPEG Tools\bin\mplex.exe" -o "%~d1%~p1%~n1.AC3.mpg" "copy.m2v" "sox.ac3" -f 3 del "copy.m2v" del "sox.ac3" "X:\Daves Folder\Sounds\VideoRedo Completed Sound Short.WAV" pause
-
-
Because the source has MPA audio and I'm converting to AC3 while demuxing MPA.
-
Right, I'm getting confused and forgot which version you're doing .
You should be able to figure these things out by now...
1) since you no longer need the normalization, you can delete the sox line
2) you can add another output from the 1st line, as ac3 - eg. "128kbps_ac3.ac3" . When doing that in ffmpeg, you need to add another -map argument. Each output, requires a -map command. It's -map 0:1 because you're using track 1 (track 0 is video, track 1 is audio) from the 1st input file (input #0)
3) change the mplex line to reflect muxing the new ac3 audio "128kbps_ac3.ac3"
4) change the delete line to reflect deleting the "128kbps_ac3.ac3"
Code:"X:\Portable Installations\ffmpeg\bin\ffmpeg.exe" -i %1 -map 0:0 -map 0:1 -map 0:1 -c:v copy -an "copy.m2v" -vn -c:a copy "%~d1%~p1%~n1.mpa" -vn -c:a ac3 -b:a 128k "128kbps_ac3.ac3" "X:\Portable Installations\MJPEG Tools\bin\mplex.exe" -o "%~d1%~p1%~n1.AC3.mpg" "copy.m2v" "128kbps_ac3.ac3" -f 3 del "copy.m2v" del "128kbps_ac3.ac3" "X:\Daves Folder\Sounds\VideoRedo Completed Sound Short.WAV" pause
-
Thanks for the MPEG2 script, it's working great.
Back to your earlier Batch script above. I tried it but it doesn't work. No files are created. I'm trying it on MKV h264 files with AAC. Also was wondering if the script processes each file one at a time as that's what I'd like? -
Yes, "serial" means one at a time
Copy & paste to a text file in the same directory as folder of mkv's to be processed, change extension from .txt to .bat, double click the .bat
Note this is different than your one at a time "send to" routine you've been doing; this processes all the mkv's in a given folder