VideoHelp Forum

Try DVDFab and copy Ultra HD Blu-rays and DVDs! Or rip iTunes movies and music! Download free trial !
+ Reply to Thread
Results 1 to 14 of 14
Thread
  1. Hi, soory but I'm a ***

    why using ffmpeg with
    Code:
    -c:a aac
    the AAC audio encoder, the resultant bitrate is alwais Variable Bit Rate ?

    I need to encode using AAC and absolutly CBR, not VBR. How is possible that? thanks
    Quote Quote  
  2. Why use a low quality aac encoder when you can use a high quality one?
    https://wiki.hydrogenaud.io/index.php?title=AAC_encoders

    Use Apple's, the best one available.
    Download iTunes and extract with this script (it comes with MeGUI)
    Code:
    @echo off
    setlocal disabledelayedexpansion
    
    for /F "tokens=1,2*" %%i in ('reg query HKLM\Software\7-Zip /v Path') do (
        set "PATH=%%k;%PATH%"
    )
    
    7z >NUL
    if not %errorlevel% == 0 (
        echo 7z.exe is required
        goto end
    )
    
    if not "%~1" == "" (
        set "installer=%~1"
    ) else if exist iTunes6464Setup.exe (
        set installer=iTunes6464Setup.exe
    ) else if exist iTunes64Setup.exe (
        set installer=iTunes64Setup.exe
    ) else if exist iTunesSetup.exe (
        set installer=iTunesSetup.exe
    ) else if exist QuickTimeInstaller.exe (
        set installer=QuickTimeInstaller.exe
    ) else (
        echo installer executable not found
        goto end
    )
    
    7z e -y "%installer%" AppleApplicationSupport.msi
    7z e -y "%installer%" AppleApplicationSupport64.msi
    
    if exist AppleApplicationSupport.msi (
        call :extract QTfiles AppleApplicationSupport.msi
    ) else (
        echo cannot extract AppleApplicationSupport.msi from installer
        goto end
    )
    if exist AppleApplicationSupport64.msi (
        call :extract QTfiles64 AppleApplicationSupport64.msi
    )
    goto end
    
    :extract
    mkdir %1
    
    7z l -i!CoreAudioToolbox.* %2 | findstr CoreAudioToolbox
    
    if errorlevel 1 (
        7z e -y -o%1 ^
                 -i!*AppleApplicationSupport_ASL.dll ^
                 -i!*AppleApplicationSupport_CoreAudioToolbox.dll ^
                 -i!*AppleApplicationSupport_CoreFoundation.dll ^
                 -i!*AppleApplicationSupport_icudt*.dll ^
                 -i!*AppleApplicationSupport_libdispatch.dll ^
                 -i!*AppleApplicationSupport_libicu*.dll ^
                 -i!*AppleApplicationSupport_objc.dll ^
                 -i!F_CENTRAL_msvc?100* ^
                 %2
    
        pushd %1
        for %%f in (AppleApplicationSupport_*.dll) do (
            for /F "tokens=1* delims=_ " %%t in ("%%f") do move /Y %%f %%u
        )
        for %%f in (x64_AppleApplicationSupport_*.dll) do (
            for /F "tokens=2* delims=_ " %%t in ("%%f") do move /Y %%f %%u
        )
    
        for %%f in (F_CENTRAL_msvcr100*) do move /Y %%f msvcr100.dll
        for %%f in (F_CENTRAL_msvcp100*) do move /Y %%f msvcp100.dll
        popd
    ) else (
        7z e -y -o%1 ^
                 -i!ASL.dll ^
                 -i!CoreAudioToolbox.dll ^
                 -i!CoreFoundation.dll ^
                 -i!*icu*.dll ^
                 -i!libdispatch.dll ^
                 -i!objc.dll ^
                 -i!pthreadVC2.dll ^
                 %2
    
        mkdir %1\Microsoft.VC80.CRT
    
        7z e -y -oQTfiles\Microsoft.VC80.CRT ^
                -i!msvcp80.dll.* ^
                -i!msvcr80.dll.* ^
                -i!manifest.* ^
                AppleApplicationSupport.msi
    
        pushd %1\Microsoft.VC80.CRT
    
        rem strip assembly version number from filenames of msvc runtime dlls
        for %%f in (msvcr80.dll.*) do move /Y %%f msvcr80.dll
        for %%f in (msvcp80.dll.*) do move /Y %%f msvcp80.dll
    
        rem find needless one out of the two manifests and remove it
        for /F "delims=:" %%t in ('findstr win32-policy manifest.*') do del %%t
    
        rem rename manifest
        for %%f in (manifest.*) do move /Y %%f Microsoft.VC80.CRT.manifest
    
        popd
    )
    exit /b
    
    :end
    if exist AppleApplicationSupport.msi del AppleApplicationSupport.msi
    if exist AppleApplicationSupport64.msi del AppleApplicationSupport64.msi
    endlocal
    Use qaac to encode audio with it. Make sure you have 7-zip installed.
    Quote Quote  
  3. Originally Posted by marcorocchini View Post
    Hi, soory but I'm a ***

    why using ffmpeg with
    Code:
    -c:a aac
    the AAC audio encoder, the resultant bitrate is alwais Variable Bit Rate ?

    I need to encode using AAC and absolutly CBR, not VBR. How is possible that? thanks
    Seem you discovered bug - after quick test aac is indeed VBR not CBR even if bitrate is reported as constant by mediainfo:

    Code:
    General
    Complete name                  : E:\Media\FF\WeaveSample_aac.mp4
    Format                         : MPEG-4
    Format profile                 : Base Media
    Codec ID                       : isom (isom/iso2/mp41)
    File size                      : 748 KiB
    Duration                       : 46 s 998 ms
    Overall bit rate mode          : Constant
    Overall bit rate               : 130 kb/s
    Writing application            : Lavf58.22.100
    
    Audio
    ID                             : 1
    Format                         : AAC LC
    Format/Info                    : Advanced Audio Codec Low Complexity
    Codec ID                       : mp4a-40-2
    Duration                       : 46 s 998 ms
    Bit rate mode                  : Constant
    Bit rate                       : 129 kb/s
    Channel(s)                     : 2 channels
    Channel layout                 : L R
    Sampling rate                  : 48.0 kHz
    Frame rate                     : 46.875 FPS (1024 SPF)
    Compression mode               : Lossy
    Stream size                    : 738 KiB (99%)
    Language                       : English
    Default                        : Yes
    Alternate group                : 1
    Image
    [Attachment 47307 - Click to enlarge]


    libfdk_aac seem also produce variable bitrate... perhaps this may be related to aac profile or something else...
    Last edited by pandy; 25th Nov 2018 at 19:30.
    Quote Quote  
  4. so is there a way to encode in CBR mode with ffmpeg?
    Quote Quote  
  5. Originally Posted by marcorocchini View Post
    so is there a way to encode in CBR mode with ffmpeg?
    No clue but issue may be related to different format (profile) of aac - perhaps try LC MPEG-2 and LC MPEG-4? Maybe true CBR aac don't exist and all codecs by CBR mean ABR mode?
    If you check this: https://hydrogenaud.io/index.php/topic,82865.0.html then answer is quite explicit:
    MPEG-2 nbc (aka aac) does not make a specification of packet sizes, but instead specifies an Average bitrate that should be achieved (ABR).
    Quote Quote  
  6. Originally Posted by marcorocchini View Post
    Hi, soory but I'm a ***

    why using ffmpeg with
    Code:
    -c:a aac
    the AAC audio encoder, the resultant bitrate is alwais Variable Bit Rate ?

    I need to encode using AAC and absolutly CBR, not VBR. How is possible that? thanks
    I might be missing something, but don't you have to specify a bitrate in order to get constant bitrate? Without it, it probably gives you the default VBR quality.

    https://trac.ffmpeg.org/wiki/Encode/AAC
    Quote Quote  
  7. Originally Posted by hello_hello View Post
    I might be missing something, but don't you have to specify a bitrate in order to get constant bitrate? Without it, it probably gives you the default VBR quality.

    https://trac.ffmpeg.org/wiki/Encode/AAC
    https://ffmpeg.org/ffmpeg-codecs.html#Options-5
    Set bit rate in bits/s. Setting this automatically activates constant bit rate (CBR) mode. If this option is unspecified it is set to 128kbps.
    Quote Quote  
  8. I guess I got that the wrong way around. I'm sure it works differently for mp3 encoding, where if you don't specify a bitrate you get VBR, specifying a bitrate on it's own gives you CBR, and specific a bitrate with -abr gives you an average bitrate encode.

    Anyway, I tried four different AAC encoders in CBR mode (ffmpeg, QAAC, FDKAAC and NeroAAC) and they all resulted in bitrates that varied a little, so I guess there's no such thing as truly CBR AAC.

    To add to the fun through, QAAC and FDK AAC both added CBR to the written encoder information, and (coincidentally?) MediaInfo declared them both to be variable bitrate.

    Code:
    Writing application                      : fdkaac 0.6.3, libfdk-aac 3.4.22, CBR 128kbps
    
    Audio
    ID                                       : 1
    Format                                   : AAC LC
    Format/Info                              : Advanced Audio Codec Low Complexity
    Codec ID                                 : mp4a-40-2
    Duration                                 : 3 min 56 s
    Bit rate mode                            : Variable
    Bit rate                                 : 128 kb/s
    Maximum bit rate                         : 163 kb/s
    Channel(s)                               : 2 channels
    Channel layout                           : L R
    Sampling rate                            : 44.1 kHz
    Frame rate                               : 43.066 FPS (1024 SPF)
    Compression mode                         : Lossy
    Stream size                              : 3.61 MiB (99%)
    Encoded date                             : UTC 2018-12-02 03:50:36
    Tagged date                              : UTC 2018-12-02 03:50:36
    Code:
    Writing application                      : qaac 2.67, CoreAudioToolbox 7.10.9.0, AAC-LC Encoder, CBR 128kbps, Quality 96
    Encoding Params                          : (Binary)
    
    Audio
    ID                                       : 1
    Format                                   : AAC LC
    Format/Info                              : Advanced Audio Codec Low Complexity
    Codec ID                                 : mp4a-40-2
    Duration                                 : 3 min 56 s
    Bit rate mode                            : Variable
    Bit rate                                 : 128 kb/s
    Maximum bit rate                         : 136 kb/s
    Channel(s)                               : 2 channels
    Channel layout                           : L R
    Sampling rate                            : 44.1 kHz
    Frame rate                               : 43.066 FPS (1024 SPF)
    Compression mode                         : Lossy
    Stream size                              : 3.61 MiB (99%)
    Encoded date                             : UTC 2018-12-02 00:43:48
    Tagged date                              : UTC 2018-12-02 00:43:54
    Quote Quote  
  9. Are you determining if it's "VBR" or "CBR" with "mediainfo" ? How accurate is that ?

    I'd put more weight in the results from a plot like the one in pandy's post. At least it looks a bit more authentic. But mediainfo said it was CBR there too....

    A long time ago, there was CT-AAC , and it was known for CBR AAC . I don't know if it's true, and I don't know of a good way to measure an audio bitrate plot
    Quote Quote  
  10. Yeah, with MediaInfo.
    I only mentioned it as I thought it was a little funny there were two encoders that included CBR along with their writing application details, and they were the two MediaInfo show as being VBR.

    I assume they're all a little VBR. Probably due to the bit reservoir system, and I remember there being a "fill" element for AAC encoders to use to keep the bitrate somewhat constant.
    I opened an encode from each encoder with MP3DirectCut and it sees them all as ABR, and I have foobar2000 configured to display the bitrate in real time, and for all four encoders it changes a little as the audio plays. No doubt they all confirm to the AAC specification in respect to CBR, but obviously it's not absolutely constant.
    Quote Quote  
  11. What about CBR vs VBR MP3 , or AC3 - can you distinguish between those in foobar2000 ?
    Quote Quote  
  12. For CBR MP3 it always jumps to something a tad higher than the constant bitrate when it begins playing the MP3, but it goes straight back to the MP3's constant bitrate and never changes after that. It shows CBR for AC3. I'm not sure I've met any VBR AC3 audio. I guess I could make one....

    For MP3 there could be more information to work with, which might help. There's info in the Xing header I'm not sure how to interpret yet, although it would appear there's bitrate information written to every MP3 frame. For a 128k CBR MP3 it's always 128. For VBR MP3 it varies.

    There's even less I understand about what MediaInfo shows for AAC, but once you drill down past the tag and element info, what it displays seems to relate to bitrate. The second two screenshots are the info MediaInfo displays close to the end of two NeroAAC encodes for a track that faded to silence. The first encode was 128k CBR. The second was encoded with Nero's default VBR setting, which resulted in a higher average bitrate, but towards the end of the track you can see the difference. If the byte values relate directly to bitrate then CBR AAC isn't always constant.

    1. MP3 128k CBR frame.
    2. AAC 128k CBR
    3. AAC VBR
    Image Attached Thumbnails Click image for larger version

Name:	1.gif
Views:	130
Size:	59.3 KB
ID:	47350  

    Click image for larger version

Name:	2.gif
Views:	118
Size:	57.8 KB
ID:	47351  

    Click image for larger version

Name:	3.gif
Views:	96
Size:	57.9 KB
ID:	47352  

    Last edited by hello_hello; 2nd Dec 2018 at 13:56.
    Quote Quote  
  13. "mediainfo" reads Bit rate mode: Variable with -c:a aac as well as
    -c:a aac -b:a 128k but
    Constant with 96k as well as 192k.

    However, with 265k and 384k I also get Variable.

    (I've tested that with -c:v libx264 and .mp4)
    Last edited by drake7; 11th Sep 2020 at 06:12.
    Quote Quote  
  14. Member Cornucopia's Avatar
    Join Date
    Oct 2001
    Location
    Deep in the Heart of Texas
    Search PM
    To mention the elephant in the room, what I'd like to know is why you think you MUST have cbr?
    Is there a service you are attempting to provide to that is expecting that? If so, do they really mean that it must, or is that just what they say to get people to encode properly? Or are you just assuming that's what they need?
    Or is it an app that is rejecting your vbr/abr encodes? I find that very unlikely.


    Scott
    Last edited by Cornucopia; 11th Sep 2020 at 20:21.
    Quote Quote  



Similar Threads