VideoHelp Forum

+ Reply to Thread
Results 1 to 13 of 13
Thread
  1. this is the following ffmpeg command line i use for encoding audio


    Code:
    -c:a ac3 -b:a 640K
    but the output file is coping the original file audio stream size.


    Original Mediainfo
    Code:
    Audio
    ID                                       : 2
    Format                                   : DTS XLL
    Format/Info                              : Digital Theater Systems
    Commercial name                          : DTS-HD Master Audio
    Codec ID                                 : A_DTS
    Duration                                 : 57 min 35 s
    Bit rate mode                            : Variable
    Bit rate                                 : 1 753 kb/s
    Channel(s)                               : 6 channels
    Channel layout                           : C L R Ls Rs LFE
    Sampling rate                            : 48.0 kHz
    Frame rate                               : 93.750 FPS (512 SPF)
    Bit depth                                : 16 bits
    Compression mode                         : Lossless
    Stream size                              : 722 MiB (6%)
    Title                                    : DTS-HD MA 5.1
    Language                                 : English
    Default                                  : Yes
    Forced                                   : No

    Encoded media info
    Code:
    Audio
    ID                                       : 2
    Format                                   : AC-3
    Format/Info                              : Audio Coding 3
    Commercial name                          : Dolby Digital
    Codec ID                                 : A_AC3
    Duration                                 : 57 min 35 s
    Bit rate mode                            : Constant
    Bit rate                                 : 640 kb/s
    Channel(s)                               : 6 channels
    Channel layout                           : L R C LFE Ls Rs
    Sampling rate                            : 48.0 kHz
    Frame rate                               : 31.250 FPS (1536 SPF)
    Bit depth                                : 16 bits
    Compression mode                         : Lossy
    Stream size                              : 722 MiB (39%)
    Title                                    : DTS-HD MA 5.1
    Writing library                          : Lavc58.65.103 ac3
    Language                                 : English
    Service kind                             : Complete Main
    Default                                  : Yes
    Forced                                   : No
    is there anyway i can get the correct stream size for the encoded file?
    Last edited by iKron; 14th May 2022 at 09:23.
    Quote Quote  
  2. The size of the encoded Ac3 IS 722Mb. (real info, not copied).
    You can test this encoding with 320k instead of 640k. This will give you a smaller output.
    Quote Quote  
  3. I suspect MediaInfo is simply wrong about the size of the AC3 stream. Demux it and see what the size really is. It should be about 276 MB, 263 MiB.
    Quote Quote  
  4. @ProWo, i tried 128K, it's still same.
    Code:
    Audio
    ID                                       : 2
    Format                                   : AC-3
    Format/Info                              : Audio Coding 3
    Commercial name                          : Dolby Digital
    Codec ID                                 : A_AC3
    Duration                                 : 57 min 35 s
    Bit rate mode                            : Constant
    Bit rate                                 : 128 kb/s
    Channel(s)                               : 6 channels
    Channel layout                           : L R C LFE Ls Rs
    Sampling rate                            : 48.0 kHz
    Frame rate                               : 31.250 FPS (1536 SPF)
    Bit depth                                : 32 bits
    Compression mode                         : Lossy
    Stream size                              : 722 MiB (42%)
    Title                                    : DTS-HD MA 5.1
    Writing library                          : Lavc59.18.100 ac3
    Language                                 : English
    Service kind                             : Complete Main
    Default                                  : Yes
    Forced                                   : No



    @jagabo after demux 640K, ac3 file size gave 263mb. is there anyway we can set the proper stream size? mkvmerge or run another ffmpeg command line?
    Quote Quote  
  5. Post your full ffmpeg encoding commandline here
    Quote Quote  
  6. Mux the demux'd AC3 file with the video stream.

    It looks to me like ffmpeg is copying the metadata (size, language, etc.) of the original DTS track and MediaInfo is reading that, not calculating the actual size of the AC3 stream.
    Quote Quote  
  7. @ProWO

    Code:
    ffmpeg -i file.mkv -map 0 -c:v copy -c:a ac3 -b:a 640K -c:s copy file_out.mkv

    @jagabo i actually have batch file like 100+ files. one thing i can do find batch script to extract AC3 file, then remove the AC3 file from the mkv and next merge the AC3 file with themkv file. but it will take some time may be 4~5 min to do the process for each file. do i have any other option?


    one source file audio "Bit rate mode : Variable" shows like this and there is no stream size info. when i encode the audio file it gave the correct stream size.

    is there anyway we can remove stream size info before encode, may be ffmpeg will give correct stream size info after encode?

    `-map_metadata -1` i found this command but it remove all the meta tag from the mkv file. like audio, subtile language info etc.
    Last edited by iKron; 14th May 2022 at 12:19.
    Quote Quote  
  8. Try your commandline without -map 0
    Quote Quote  
  9. without -map 0 is also same result
    Quote Quote  
  10. it's not perfect but this one will fix the issue:

    Code:
    mkvpropedit file.mkv --add-track-statistics-tags
    ProWo and jagabo thanks a lot for the help.
    Quote Quote  
  11. Seems to be a ffmpeg bug.
    Try another ffmpeg release, maybe newer.
    Quote Quote  
  12. i tried latest one, still same issue. well mkvpropedit does not take much time, it's almost instant.
    Quote Quote  
  13. Originally Posted by iKron View Post
    it's not perfect but this one will fix the issue:

    Code:
    mkvpropedit file.mkv --add-track-statistics-tags
    ProWo and jagabo thanks a lot for the help.
    Yes, that sounds like your best bet.
    Quote Quote  



Similar Threads