VideoHelp Forum


Try DVDFab Video Downloader and rip Netflix video! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Page 1 of 7
1 2 3 ... LastLast
Results 1 to 30 of 199
Thread
  1. I was advised that instead of normalizing the volume to 0dB that instead I should normalize to -10 dB.

    What part of the following script should I change to do that?

    Code:
    "X:\Portable Installations\ffmpeg-2014 May 14-git-72dcd48-win64-static\bin\ffmpeg.exe" -i %1 -c copy -absf aac_adtstoasc -vn gain.m4a
    "X:\Portable Installations\AAC Gain 1.9\aacgain" -r -k -m 10 gain.m4a
    "X:\Portable Installations\ffmpeg-2014 May 14-git-72dcd48-win64-static\bin\ffmpeg.exe" -i %1 -i gain.m4a -map 0:v -map 1 -c:v copy -c:a ac3 -ab 2 -ab 128k "%~d1%~p1%~n1.AC3.ts"
    "X:\Portable Installations\ffmpeg-2014 May 14-git-72dcd48-win64-static\bin\ffmpeg.exe" -i gain.m4a -acodec copy "%~d1%~p1%~n1.aac"
    del gain.m4a
    The above script demuxes the AAC into an aac file and amplifies volume to 0dB.
    The bottom line converts the AAC into an AC3 file and muxes with the original TS file to create a file called "original file name.AC3.ts"

    Also does the demuxed AAC file get re-encoded due to the amplification or does AAC Gain work without re-encoding the audio?
    Quote Quote  
  2. Originally Posted by VideoFanatic View Post
    I was advised that instead of normalizing the volume to 0dB that instead I should normalize to -10 dB.
    I don't use ffmeg myself and I don't fully understand the AACGain commandline (although I'm reading up on it as I post), but it sounds like..... when you refer to normalising to 0dB..... you're referring to adjusting the volume until the peaks are at maximum. AACGain can do the same, but generally the idea would be to use it to adjust the level with ReplayGain so each track's volume sounds the same.

    As far as I know AACGain doesn't re-encode (I use it with the mp3gain GUI). If it does it'd be much slower than adjusting the volume without re-encoding, which should only take a second. The actual ReplayGain scanning process might take a few minutes though.

    The standard "target volume" when applying ReplayGain to music is 89dB, but movie soundtracks tend to be a bit more dynamic so it's an idea to reduce that a bit for some extra headroom (so the peaks won't exceed maximum). 86dB is probably better. 83dB should ensure no peaks exceed the maximum..... 99.99% of the time.

    The way I read the commandline, after ReplayGain has been applied, -m 10 would increase the volume by ten steps of 1.5dB, or by 15dB. I'm not sure why you'd want to do that. If anything, I'd imagine the idea would be to apply ReplayGain (which adjusts to a target volume of 89dB) along with a further reduction of 3dB or 6dB to prevent clipping. So something like:

    -r -d -6

    You can add the -k switch, which appears to prevent clipping automatically (the way I read the commandline it'll adjust to 89dB and then reduces the volume further if required).

    -r -k

    The only downside is the -k switch might further modify the volume of some files and not others, which means they might have slightly different volumes. It'll generally only be a few dB difference, so no big deal, but an alternative might be

    -r d -6 -k

    That should adjust the level to a target volume of 83dB and the -k switch is still there to prevent clipping on the rare occasion it occurs.

    Because I use the mp3gain GUI, if I'm wanting to adjust the volume of a bunch of files so they all sound the same, I run a ReplayGain scan and adjust the target volume until the file with the loudest peaks reaches maximum. It more often than not ends up being between 83dB to 86dB. Once I know the highest target volume I can use I apply ReplayGain.
    Last edited by hello_hello; 8th Jun 2014 at 20:51.
    Quote Quote  
  3. I happened to have 4 tracks from an old TV show sitting on my hard drive (mp3s) so I thought I'd give them a quick scan. They're the commentary tracks, not the standard ones. Once I ran ReplayGain I reduced the target volume until the adjustment would no longer cause clipping. The target volume required in this case turned out to be 87dB.

    Image
    [Attachment 25610 - Click to enlarge]
    Quote Quote  
  4. Fair enough. If you're confident the sample from your previous thread is indicative of all audio tracks, you'll never have a problem with clipping.

    I looked at you other thread and to be honest I'm not sure if you fully understand the question you're asking. There's no "value" as such for dB. It's just a scale. Most audio editors use 0dB as "maximum" and everything below that has a negative dB value. The example from your previous thread has peaks around -5dB.

    The ReplayGain target volume is based on a SMPTE standard for translating what you see in your audio editor into sound pressure level (using the dB scale) when a movie theatre system is properly calibrated. ie if you run pink noise through this theatre system at this voltage then this is how loud it should be. Hence the 89dB. (except I think the SMPTE standard is actually 83dB to allow for more dynamic range before clipping).
    http://wiki.hydrogenaud.io/index.php?title=ReplayGain_1.0_specification

    My understanding of your question..... how to normalise to -10dB.... would mean effectively increasing the volume until the loudest part is at 0dB in your audio editor, then reducing the volume of the whole audio until the loudest part is at -10dB. That'd be what I call "normalising to -10dB". And that's pretty much what ReplayGain sets out not to do, because if audio "A" and audio "B" have the same average volume, but audio "B" happens to have a peak that's 10dB louder than the loudest part of audio "A", when they're both "normalised to -10dB"..... the average volume for audio "B" will end up 10dB lower.
    Instead, ReplayGain aims to make the average volumes the same and therefore the peaks will often be different, but it doesn't use the same dB scale as your audio editor. Instead it uses a standard for translating the audio into sound pressure level. I don't really know why.....

    Anyway, if jagabo pops into this thread I'll defer to him regarding "commercial releases usually having AC3 audio encoded at about -10 dB" and whether he's referring to peak or average levels etc, or whether it's something which just applies to AC3 (I never encode as AC3 myself). I'm not sure. I just use ReplayGain, generally with a target volume of 83dB. Sometimes the peaks will be even more than 10dB below 0dB (in an audio editor), sometimes they'll only be 1 or 2dB lower, but the average volume should be pretty similar.
    Last edited by hello_hello; 10th Jun 2014 at 12:17. Reason: spelling
    Quote Quote  
  5. It is advised to limit maximum level to -3.01dBFS (sometimes -6.02dBFS), also it is advised to equalize (balance) all tracks to common average (loudness) level to avoid sudden level changes between tracks - usually this level is around -20 : -12dBFS - there is no standard (except Dolby standard and EBU R128) but from mathematical point of view it is good to avoid going really to 0dBFS unless you can verify that after low pass filtering (reconstruction filter) no clipping will occur.

    So use some "smart" loudness level adjustment + peaks should go not higher than -3.01dBFS and everything should be OK for almost anything i can imagine.
    Quote Quote  
  6. A problem is that the MKV output by FFMPEG has a 1 minute 5 second delay. There's no audio for the first 1 minute 5 seconds and I can see the delay mentioned in MediaInfo. How can I prevent FFMPEG from causing a delay? It doesn't matter what the length is of the source video. I even got a 1 minute 5 second delay on a video that's only 1 minute long! Here's the 1 minute video.

    Here's my FFMPEG script:

    Code:
    "X:\Portable Installations\ffmpeg\bin\ffmpeg.exe" -i %1 -c copy -absf aac_adtstoasc -vn 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 -acodec copy "%~d1%~p1%~n1.aac"
    "X:\Portable Installations\ffmpeg\bin\ffmpeg.exe" -i %1 -i gain.m4a -map 0:v -map 1 -c:v copy -c:a ac3 -ab 2 -ab 128k "%~d1%~p1%~n1.AC3.mkv"
    del gain.m4a
    "X:\Daves Folder\Sounds\VideoRedo Completed Sound Short.WAV"
    pause
    The above script Muxes MKV to MKV, normalizes the volume in the AAC and demuxes to an AAC file and re-encodes AAC to AC3 in the MKV.
    Last edited by VideoFanatic; 28th Jul 2014 at 13:40.
    Quote Quote  
  7. Seeing that you started out with a transport stream and yoru sample is an mkv file.
    If that a remux of the source or one of the messed up output files?

    Also have you:
    • checked that the input is really is okay? (there are a few tools to analyse transport streams)
    • looked at the time codes of the file? (remuxing the file with mkvmerge to mkv and doing all the other stuff on the mkv might help; you can extract timecodes from mkv files using mkvextract)
    • tried if the delay also happens if you don't use aacgain?
    • When you remux the input with mkvmerge and ffmpeg
      • is the remuxed file you get when remuxing with ffmpeg to mkv still synch?
      • is the remuxed file you get when remuxing with mkvmerge to mkv still synch?

    There's no audio for the first 1 minute 5 seconds and I can see the delay mentioned in MediaInfo.
    .... and now you want us to guess what mediainfo reported?

    -> post a sample of the input you are having the issue with and that allow others to reproduce the issue using ffmpeg&aacgain.

    Cu Selur
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  8. Source is MP4 from the Elgato Game Capture HD which I then saved to MKV with VideoRedo. I can save the MP4 to any format with VideoRedo and there's no delay in MediaInfo. Haven't tried any tools to analyze transport streams as the VideoRedo files are fine because I can re-encode any file saved with VideoRedo with MeGUI or whatever and there's no delay in the resulting file. So the VideoRedo file is OK and it's in sync with no delay mentioned in MediaInfo.

    If I take a VideoRedo saved file and then use FFMPEG to remux it but re-encode the AAC to AC3 then the resulting file is out of sync with a 1 min 5 sec delay mentioned in MediaInfo. Makes no difference if I use AAC Gain or not. If I then take the FFMPEG file and remux it with VideoRedo then the delay is gone again. So it's FFMPEG that's causing the problem.

    Posted the 1 minute MKV source in my last post. Here it is. 1 minute clip

    I haven't looked at the timecodes of the file. If I have to manually check the timecode and enter it in my script it defeats the purpose of using the script (for quickness).

    If I understand you correctly you're asking if I mux my source with MKVMerge GUI then use FFMPEG on the resulting file then do I get a delay. Yes I do.

    Don't really know anything about MKVMerge other than the GUI which I've never had cause to use. Could use MKVMerge instead of FFMPEG in the script? I'm not really bothered that programs are used in the script as long as the goal of the script is accomplished as follows:

    I want the script to Mux MKV/TS/M2TS to MKV (MKV is a necessity), normalize the volume in the AAC and demux to an AAC file and re-encode AAC to AC3 in the MKV.

    Here's the MediaInfo result for the 1 minute MKV I saved with VideoRedo.

    General
    Unique ID : 184907774782912354432769985668317869495 (0x8B1BF1298FFAB9A90F571F70D43A75B7)
    Complete name : E:\2 = New\Superstars 2014 July 24 clip.mkv
    Format : Matroska
    Format version : Version 2
    File size : 148 MiB
    Duration : 1mn 3s
    Overall bit rate mode : Variable
    Overall bit rate : 19.6 Mbps
    Writing application : Lavf53.31.100
    Writing library : Lavf53.31.100

    Video
    ID : 1
    Format : AVC
    Format/Info : Advanced Video Codec
    Format profile : High@L4.0
    Format settings, CABAC : Yes
    Format settings, ReFrames : 2 frames
    Format settings, GOP : M=3, N=12
    Codec ID : V_MPEG4/ISO/AVC
    Bit rate mode : Variable
    Maximum bit rate : 29.9 Mbps
    Width : 1 920 pixels
    Height : 1 080 pixels
    Display aspect ratio : 16:9
    Frame rate mode : Variable
    Original frame rate : 25.000 fps
    Color space : YUV
    Chroma subsampling : 4:2:0
    Bit depth : 8 bits
    Scan type : Interlaced
    Scan order : Top Field First
    Default : Yes
    Forced : No
    Color primaries : BT.709
    Transfer characteristics : BT.709
    Matrix coefficients : BT.709

    Audio
    ID : 2
    Format : AAC
    Format/Info : Advanced Audio Codec
    Format profile : LC
    Codec ID : A_AAC
    Duration : 1mn 3s
    Channel(s) : 2 channels
    Channel positions : Front: L R
    Sampling rate : 48.0 KHz
    Compression mode : Lossy
    Language : English
    Default : Yes
    Forced : No
    Quote Quote  
  9. Source is MP4 from the Elgato Game Capture HD which I then saved to MKV with VideoRedo.
    okay,...in the first post you wrote:
    The bottom line converts the AAC into an AC3 file and muxes with the original TS file to create a file called "original file name.AC3.ts"
    -> I assume you are starting with an mp4 file.

    I can save the MP4 to any format with VideoRedo and there's no delay in MediaInfo.
    Sorry, no clue about VideoRedo.

    Haven't tried any tools to analyze transport streams as the VideoRedo files are fine because I can re-encode any file saved with VideoRedo with MeGUI or whatever and there's no delay in the resulting file.
    okay, so we assume the input is okay and cfr, otherwise some tools are bound to have problems.
    Oh,....
    Frame rate mode : Variable
    the output of VideoRedo is vfr!

    Posted the 1 minute MKV source in my last post. Here it is. 1 minute clip
    Ah, okay it wasn't clear that this is from the source.
    -> will look at the file and report back in a few minutes
    -> So either your source already vfr or VideoRedo does something strange or MediaInfo is mistaken.
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  10. Okay, simply ignoring the time codes seems to help.
    What I did:
    1. extract audio and video
    Code:
    mkvextract tracks "C:\Users\Selur\Desktop\Superstars 2014 July 24 clip.mkv" 1:"H:\Temp\audio.aac" 0:"H:\Temp\video.264"
    2. reencode the audio to ac3 and boost the volume with sox*:
    Code:
    ffmpeg -y -threads 8 -loglevel fatal -i "H:\Temp\audio.aac" -ac 2 -ar 48000 -f sox - | sox --multi-threaded --ignore-length --temp "H:\Temp" --buffer 524288 -S -t sox - -b 16 -t sox - gain -n | ffmpeg -y   -threads 8 -f sox -i - -b:a 192k -ac 2 -ar 48000 "H:\Temp\audio.ac3"
    3. I multiplex audio and video:
    Code:
    mkvmerge --ui-language en -o "H:\Output\Superstars 2014 July 24 clip.mkv" --disable-track-statistics-tags -d 0 --default-track 0:yes --default-duration 0:50i --aspect-ratio-factor 0:1/1 --fourcc 0:MP4V --no-chapters --compression -1:none --forced-track 0:yes --no-audio --no-subtitles "H:\Temp\video.264" --language 0:en --default-track 0:yes --forced-track 0:no -a 0 --compression -1:none --no-video --no-subtitles --no-chapters "H:\Temp\audio.ac3"
    -> result plays fine and adjusting these calls in a way to use them in a batch shouldn't be problematic.

    * I strongly recommend reading http://forum.selur.de/topic239-info-understanding-the-audio-gain-methods.html and the sox documentation. I simply choose the default auto gain method I use in Hybrid, but depending on you liking other methods might be more suited.


    -> So the main differences between my approach and yours are:
    1. I extract both audio&video raw streams and this way ignore any strange time codes the file might include
    2. I don't use aacgain to first apply a replay gain and then reencode the new file, I decode the audio and apply the normalization with sox and then feed the sox output directly to the encoder.
    3. I mux&demux with mkvmerge&mkvextract instread of ffmpeg.

    ----

    btw. vfr is reported since the time codes do not start at 0 but at 200ms for the video stream, if this wasn't a mistake one needs to also check the delay info and respect it during remuxing.


    Cu Selur

    Ps.: you could also use ffmpeg for the extraction and remuxing, but I normally prefer mkvmerge&mkvextract when dealing with transport streams.

    PPs.: Yes, this could also be done with Hybrid. (which can do batch processing and monitor folders)
    Last edited by Selur; 28th Jul 2014 at 15:17.
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  11. Does your script Mux to MKV, Demux AAC into AAC file, Normalize it and re-encode AAC into AC3 within MKV? At the moment with my previous FFMPEG script I would put the script in a batch file in the "Send To" directory then I would right-click on a video I want to convert then I select Send To: the batch file I created. I didn't need to adjust the filename in the script every time I wanted to convert a video, it would just convert it to a filename which is the same as the original but with the underlined text as follows added to the end of the filename.AC3.mkv.

    Could you possibly give me the script for that please as I'm hopeless when it comes to coding like this. Also I couldn't get your script to run. I assumed I had to add the program locations so I did that but it still won't run.

    Code:
    "X:\Portable Installations\MKV Toolnix\mkvextract.exe" tracks "E:\2 = New\Superstars 2014 July 24 clip" 1:"E:\2 = New\audio.aac" 0:"E:\2 = New\video.264"
    
    ffmpeg -y -threads 8 -loglevel fatal -i "E:\2 = New\audio.aac" -ac 2 -ar 48000 -f sox - 
    | sox --multi-threaded --ignore-length --temp 
    "E:\2 = New\" --buffer 524288 -S -t sox - -b 16 -t sox - gain -n 
    | ffmpeg -y   -threads 8 -f sox -i - -b:a 192k -ac 2 -ar 48000 "E:\2 = New\audio.ac3"
    
    "X:\Portable Installations\MKV Toolnix\mkvmerge.exe" 
    --ui-language en -o "E:\2 = New\Superstars 2014 July 24 clip.mkv" 
    --disable-track-statistics-tags -d 0 --default-track 0:yes --default-duration 0:50i --aspect-ratio-factor 0:1/1 
    --fourcc 0:MP4V --no-chapters --compression -1:none --forced-track 0:yes --no-audio --no-subtitles "E:\2 = New\video.264" 
    --language 0:en --default-track 0:yes --forced-track 0:no -a 0 --compression -1:none --no-video --no-subtitles --no-chapters "E:\2 = New\audio.ac3"
    Regarding what you said about VFR: No idea why MediaInfo says it's variable frame rate. Sometimes MediaInfo says it's variable and sometimes it says it's constant. VideoRedo doesn't re-encode so it must be using constant framerate. Regardless I used MKVMerge and MediaInfo said it was constant frame rate then I used my original FFMPEG script on that and it still had a 1 min 5 sec delay.
    Quote Quote  
  12. Code:
    Does your script Mux to MKV, Demux AAC into AAC file, Normalize it and re-encode AAC into AC3 within MKV?
    I thought I wrote step-by-step what the script does.
    1. extract audio&video to raw2
    2. reencode raw aac audio to raw ac3 and normalize in one step
    3. remux the ne audio file.
    so I got three lines.

    And yes, if you use my calls in a script you should use absolute paths to the tools.
    Sorry, but I'm not writing batch files, but I guess there should be tons of users here who do that.
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  13. OK thanks. I used absolute paths as follows but it's not working. Don't know what I'm doing wrong.

    Code:
    "X:\Portable Installations\MKV Toolnix\mkvextract.exe" tracks "E:\2 = New\Superstars 2014 July 24 clip" 1:"E:\2 = New\audio.aac" 0:"E:\2 = New\video.264"
    "X:\Portable Installations\ffmpeg\bin\ffmpeg.exe" -y -threads 8 -loglevel fatal -i "E:\2 = New\audio.aac" -ac 2 -ar 48000 -f sox - | sox --multi-threaded --ignore-length --temp "E:\2 = New\" --buffer 524288 -S -t sox - -b 16 -t sox - gain -n | "X:\Portable Installations\ffmpeg\bin\ffmpeg.exe" -y   -threads 8 -f sox -i - -b:a 192k -ac 2 -ar 48000 "E:\2 = New\audio.ac3"
    "X:\Portable Installations\MKV Toolnix\mkvmerge.exe" --ui-language en -o "E:\2 = New\Superstars 2014 July 24 clip.mkv" --disable-track-statistics-tags -d 0 --default-track 0:yes --default-duration 0:50i --aspect-ratio-factor 0:1/1 --fourcc 0:MP4V --no-chapters --compression -1:none --forced-track 0:yes --no-audio --no-subtitles "E:\2 = New\video.264" --language 0:en --default-track 0:yes --forced-track 0:no -a 0 --compression -1:none --no-video --no-subtitles --no-chapters "E:\2 = New\audio.ac3"
    Quote Quote  
  14. You missed sox in the second call
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  15. OK I added the sox location and added pause to the script so I can see any errors in the CMD. At the moment a separate .h264 and AAC is created and the CMD says "Unknown Input format: "X:\Portable Installations\Sox\sox.exe". I downloaded sox and put it in that location so I don't know what the problem is.
    Quote Quote  
  16. I attached the sox&ffmpeg versions I normally use, other than that the call cools fine.
    Image Attached Files
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  17. Never encountered any clipping with "gain -n" on my equipment and skimming over the pdfs it sound more like the problem was due to faulty consumer equipment. (Hybrid allows to adjust the gain target level; auto = 0, manual = user sets it)

    Also were does the '3.0103' come from? (didn't see that value mentioned anywhere,..)
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  18. OK here's what I've got:

    Code:
    "X:\Portable Installations\MKV Toolnix\mkvextract.exe" tracks "E:\2 = New\Superstars 2014 July 24 clip.mkv" 1:"E:\2 = New\audio.aac" 0:"E:\2 = New\video.264"
    "X:\Portable Installations\Batch\ffmpeg.exe" -y -threads 8 -loglevel fatal -i "E:\2 = New\audio.aac" -ac 2 -ar 48000 -f "X:\Portable Installations\Batch\sox.exe" - | "X:\Portable Installations\Batch\sox.exe" --multi-threaded --ignore-length --temp "E:\2 = New\" --buffer 524288 -S -t "X:\Portable Installations\Sox\sox.exe" - -b 16 -t "X:\Portable Installations\Sox\sox.exe" - gain -n | "X:\Portable Installations\Batchffmpeg.exe" -y   -threads 8 -f "X:\Portable Installations\Batch\sox.exe" -i - -b:a 192k -ac 2 -ar 48000 "E:\2 = New\audio.ac3"
    "X:\Portable Installations\MKV Toolnix\mkvmerge.exe" --ui-language en -o "E:\2 = New\Superstars 2014 July 24 clip.mkv" --disable-track-statistics-tags -d 0 --default-track 0:yes --default-duration 0:50i --aspect-ratio-factor 0:1/1 --fourcc 0:MP4V --no-chapters --compression -1:none --forced-track 0:yes --no-audio --no-subtitles "E:\2 = New\video.264" --language 0:en --default-track 0:yes --forced-track 0:no -a 0 --compression -1:none --no-video --no-subtitles --no-chapters "E:\2 = New\audio.ac3"
    "X:\Daves Folder\Sounds\VideoRedo Completed Sound Short.WAV"
    pause
    The script runs but only a seperate AAC and .h264 is created. No MKV is created. Also the CMD doesn't pause. Tried with the file you gave me.
    Quote Quote  
  19. a. Have your tried calling the line one by one in a terminal to check if you made a typo somewhere.
    b. You are aware that your input and output file is the same, right?
    Code:
    mkvextract.exe" tracks "E:\2 = New\Superstars 2014 July 24 clip.mkv"
    Code:
    mkvmerge.exe" --ui-language en -o "E:\2 = New\Superstars 2014 July 24 clip.mkv"
    (not sure what mkvmerge will to if the output already exists, it might just add the streams to the existing mkv, it might abort or it might overwrite the file)
    c. your sox call it broken:
    should be:
    Code:
    "X:\Portable Installations\Batch\sox.exe" --multi-threaded --ignore-length --temp "E:\2 = New\" --buffer 524288 -S -t sox - -b 16 -t sox - gain -n
    '-t sox' specifies that a stream format (first the input, seconds the output format)
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  20. Originally Posted by Selur View Post
    Never encountered any clipping with "gain -n" on my equipment and skimming over the pdfs it sound more like the problem was due to faulty consumer equipment. (Hybrid allows to adjust the gain target level; auto = 0, manual = user sets it)

    Also were does the '3.0103' come from? (didn't see that value mentioned anywhere,..)
    First: frequently you can find clipped mp3's as many people completely ignore fact that lossy compression as in mp3 or ac3 is based on bank filters and that there is no longer linear quantization for signal level - later at the decoding clipping can occurs, sometimes replygain can help, sometimes not and decoded audio in PCM domain is irrecoverably clipped.

    Second 3.0103 is due of SQRT(2) or if You prefer 1/Sin(45deg) (both numbers are valid and important in audio world).
    This value is sometimes simplifed and written as -3dBFS or +3dBFS and also it is "half of the bit" so reducing normalization by -3.0103 dB we lossing half of bit - 15.5 when compared to 16 where 0dBFS is our normalization goal.
    Quote Quote  
  21. Checked to make sure I used the same directories as you. 1st line works. 2nd line fails.

    Code:
    "X:\Portable Installations\MKV Toolnix\mkvextract.exe" tracks "E:\2 = New\Superstars 2014 July 24 clip.mkv" 1:"E:\2 = New\audio.aac" 0:"E:\2 = New\video.264"
    "X:\Portable Installations\Batch\ffmpeg.exe" -y -threads 8 -loglevel fatal -i "E:\2 = New\Temp\audio.aac" -ac 2 -ar 48000 -f "X:\Portable Installations\Batch\sox.exe" --multi-threaded --ignore-length --temp "E:\2 = New\Temp" --buffer 524288 -S -t sox - -b 16 -t sox - gain -n | "X:\Portable Installations\Batch\ffmpeg.exe" -y -threads 8 -f "X:\Portable Installations\Batch\sox.exe" -i - -b:a 192k -ac 2 -ar 48000 "E:\2 = New\Temp\audio.ac3"
    "X:\Portable Installations\MKV Toolnix\mkvmerge.exe" --ui-language en -o "E:\2 = New\Superstars 2014 July 24 clip AC3.mkv" --disable-track-statistics-tags -d 0 --default-track 0:yes --default-duration 0:50i --aspect-ratio-factor 0:1/1 --fourcc 0:MP4V --no-chapters --compression -1:none --forced-track 0:yes --no-audio --no-subtitles "E:\2 = New\video.264" --language 0:en --default-track 0:yes --forced-track 0:no -a 0 --compression -1:none --no-video --no-subtitles --no-chapters "E:\2 = New\Temp\audio.ac3"
    pause
    Does the script need to have all those settings in it as it's making the script difficult to read.
    Quote Quote  
  22. @VideoFanatic: There was still an additional sox-format indication you turned into a path:
    Code:
    "X:\Portable Installations\Batch\ffmpeg.exe" -y -threads 8 -loglevel fatal -i "E:\2 = New\Temp\audio.aac" -ac 2 -ar 48000 -f "X:\Portable Installations\Batch\sox.exe" --multi-threaded --ignore-length --temp "E:\2 = New\Temp" --buffer 524288 -S -t sox - -b 16 -t sox - gain -n | "X:\Portable Installations\Batch\ffmpeg.exe" -y -threads 8 -f sox -i - -b:a 192k -ac 2 -ar 48000 "E:\2 = New\Temp\audio.ac3"
    Does the script need to have all those settings in it as it's making the script difficult to read.
    That depends on what you want to do, every setting has a meaning. (-> you might want to read the ffmpeg&sox documentation, also iirc in batch files there should be a way to insert line-breaks for readability, I think it might be using a '^')

    @pandy: Okay, I got the 3.0103 ~ 20*log10(sqrt(2)) = 3dB.

    But I'm still a bit confused by why aiming for 3dB would be better.
    The point that there are clipped mp3s doesn't really seems like an explanation, why we would want to lose half of the a bit,..
    If your source is clipped your decoder will not magically fix that.
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  23. Fails on second line. CMD just disappears. Am I actually supposed to to enter the absolute path to sox? If so, where do I enter it? I entered it where I first saw sox mentioned.

    Code:
    "X:\Portable Installations\MKV Toolnix\mkvextract.exe" tracks "E:\2 = New\Superstars 2014 July 24 clip.mkv" 1:"E:\2 = New\Temp\audio.aac" 0:"E:\2 = New\Temp\video.264"
    "X:\Portable Installations\Batch\ffmpeg.exe" -y -threads 8 -loglevel fatal -i "E:\2 = New\Temp\audio.aac" -ac 2 -ar 48000 -f "X:\Portable Installations\Batch\sox.exe"  - | sox --multi-threaded --ignore-length --temp "E:\2 = New\Temp" --buffer 524288 -S -t sox - -b 16 -t sox - gain -n | "X:\Portable Installations\Batch\ffmpeg.exe" -y -threads 8 -f sox -i - -b:a 192k -ac 2 -ar 48000 "E:\2 = New\Temp\audio.ac3"
    "X:\Portable Installations\MKV Toolnix\mkvmerge.exe" --ui-language en -o "E:\2 = New\Superstars 2014 July 24 clip AC3.mkv" --disable-track-statistics-tags -d 0 --default-track 0:yes --default-duration 0:50i --aspect-ratio-factor 0:1/1 --fourcc 0:MP4V --no-chapters --compression -1:none --forced-track 0:yes --no-audio --no-subtitles "E:\2 = New\Temp\video.264" --language 0:en --default-track 0:yes --forced-track 0:no -a 0 --compression -1:none --no-video --no-subtitles --no-chapters "E:\2 = New\Temp\audio.ac3"
    pause
    Quote Quote  
  24. Originally Posted by Selur View Post
    @pandy: Okay, I got the 3.0103 ~ 20*log10(sqrt(2)) = 3dB.

    But I'm still a bit confused by why aiming for 3dB would be better.
    The point that there are clipped mp3s doesn't really seems like an explanation, why we would want to lose half of the a bit,..
    If your source is clipped your decoder will not magically fix that.
    It is better as it provide unconditionally clip free level for all cases - when you see signal only as a frequency and level there is also phase involved

    Code:
    PI sin cos 3.14 0 -1 2.09 0.87 -0.5 1.05 0.87 0.5 0 0 1 -1.05 -0.87 0.5 -2.09 -0.87 -0.5 -3.14 0 -1
    sin and cos are completely different when peak values are considered - sin is only +-0.87 peak where cos is +-1 - if you normalize sin to 0dBFS (i.e. +-1) it will be clipped as peak located between both samples will +3dB higher than 0dBFS - any filtering will notice this and provide clipped/distorted sine where sampling values will be inside digital then in analog world they will be outside.
    This is why normalization to -3.0103dBFS gives 100% cases non clipped audio where normalization to 0dBFS can give clipping 3.0103dB high - we can't ignore phase relation and RMS value of signal (and RMS means filtering/integration is involved).

    btw - we not lose half bit - first mp3 (ac3, aac) use signals between +-1 (or 0 and 1) and most of encoders can deal easily with more than 16 bit at the input, second we need to leave space for dithering (as unavoidable part of the decent re-qantization algorithm which seem to be integral part of each decoder) - dithering have own level usual TPDF have level around pp 1 -1.5bit where aggressive, noise shaped dithering can have levels more than pp 3 - 4 bits, this is why recordings should be usually not normalized to 0dBFS but sufficient room to provide clip free processing in digital domain should be provided. So go for 24 bits, normalize to at least -3.0103dBFS and everything should be fine (btw dithering should be removed before compression - usually this is not possible as PCM sources are used thus compression should after lowpass filter).
    Last edited by pandy; 29th Jul 2014 at 10:27.
    Quote Quote  
  25. Originally Posted by VideoFanatic View Post
    Fails on second line. CMD just disappears. Am I actually supposed to to enter the absolute path to sox? If so, where do I enter it? I entered it where I first saw sox mentioned.


    In the 2nd line -f sox shouldn't have the path (it's defining the output format for ffmpeg, not calling sox.exe)

    Code:
    "X:\Portable Installations\Batch\ffmpeg.exe" -y -threads 8 -loglevel fatal -i "E:\2 = New\Temp\audio.aac" -ac 2 -ar 48000 -f sox - | sox --multi-threaded --ignore-length --temp "E:\2 = New\Temp" --buffer 524288 -S -t sox - -b 16 -t sox - gain -n | "X:\Portable Installations\Batch\ffmpeg.exe" -y -threads 8 -f sox -i - -b:a 192k -ac 2 -ar 48000 "E:\2 = New\Temp\audio.ac3"
    Quote Quote  
  26. I'm not getting anywhere. Tried without sox path in the 2nd line and I get the same result as before. Can you please give me the correct script to use and I'll just change the paths to my own.
    Quote Quote  
  27. sox.exe should have the path, -f sox shouldn't have the path

    Or, if you 're using these frequently, you can setup environment variables and forget about paths to sox, ffmpeg, etc...

    Code:
    "X:\Portable Installations\Batch\ffmpeg.exe" -y -threads 8 -loglevel fatal -i "E:\2 = New\Temp\audio.aac" -ac 2 -ar 48000 -f sox - | "X:\Portable Installations\Batch\sox.exe" --multi-threaded --ignore-length --temp "E:\2 = New\Temp" --buffer 524288 -S -t sox - -b 16 -t sox - gain -n | "X:\Portable Installations\Batch\ffmpeg.exe" -y -threads 8 -f sox -i - -b:a 192k -ac 2 -ar 48000 "E:\2 = New\Temp\audio.ac3"
    Quote Quote  
  28. @VideoFanatic:
    the second line consist of three calls which are combined using pipes ('|'); a pipe sends the output of one call to the next
    call 1:
    Code:
    ffmpeg -y -threads 8 -loglevel fatal -i "H:\Temp\audio.aac" -ac 2 -ar 48000 -f sox -
    call 2:
    Code:
    sox --multi-threaded --ignore-length --temp "H:\Temp" --buffer 524288 -S -t sox - -b 16 -t sox - gain -n
    call 3:
    Code:
    ffmpeg -y   -threads 8 -f sox -i - -b:a 192k -ac 2 -ar 48000 "H:\Temp\audio.ac3"
    at the beginning of each call is the name of the binary/program that get's called and if you use a batch file you need to use the absolute path to each binary.

    So for call 1, we get:
    Code:
    "X:\Portable Installations\Batch\ffmpeg.exe"-y -threads 8 -loglevel fatal -i "H:\Temp\audio.aac" -ac 2 -ar 48000 -f sox -
    for call 2, we get:
    Code:
    "X:\Portable Installations\Batch\sox.exe" --multi-threaded --ignore-length --temp "H:\Temp" --buffer 524288 -S -t sox - -b 16 -t sox - gain -n
    for call 3, we get:
    Code:
    "X:\Portable Installations\Batch\ffmpeg.exe" -y   -threads 8 -f sox -i - -b:a 192k -ac 2 -ar 48000 "H:\Temp\audio.ac3"
    and if we combine theses again, we get:
    Code:
    "X:\Portable Installations\Batch\ffmpeg.exe"-y -threads 8 -loglevel fatal -i "H:\Temp\audio.aac" -ac 2 -ar 48000 -f sox - | "X:\Portable Installations\Batch\sox.exe" --multi-threaded --ignore-length --temp "H:\Temp" --buffer 524288 -S -t sox - -b 16 -t sox - gain -n | "X:\Portable Installations\Batch\ffmpeg.exe" -y   -threads 8 -f sox -i - -b:a 192k -ac 2 -ar 48000 "H:\Temp\audio.ac3"
    now we replace "H:\temp" with "E:\2 = New" and get
    Code:
    "X:\Portable Installations\Batch\ffmpeg.exe"-y -threads 8 -loglevel fatal -i "E:\2 = New\audio.aac" -ac 2 -ar 48000 -f sox - | "X:\Portable Installations\Batch\sox.exe" --multi-threaded --ignore-length --temp "E:\2 = New" --buffer 524288 -S -t sox - -b 16 -t sox - gain -n | "X:\Portable Installations\Batch\ffmpeg.exe" -y   -threads 8 -f sox -i - -b:a 192k -ac 2 -ar 48000 "E:\2 = New\audio.ac3"
    @pandy: shouldn't normalization always take peak values into account? And how come I never got clipping when using 'gain -n' and not 'gain -n 3.0103'?
    users currently on my ignore list: deadrats, Stears555
    Quote Quote