VideoHelp Forum
+ Reply to Thread
Results 1 to 19 of 19
Thread
  1. Hello,

    Is it possible to use a lossless compressed FLAC audio track in an MP4 file?

    The MP4 files are most commonly used on WhatsApp, YouTube, etc but have a lossy AAC audio track.

    I came across this link which suggests using MKV container instead of MP4:
    http://forum.doom9.org/archive/index.php/t-157319.html

    Does it mean that this bottleneck is integral to MP4 format?

    Thanks
    Sword is no substitute for kitchen-knife.
    Quote Quote  
  2. Yes, the .mp4 container does not support flac. Normally you would use alac when going for lossless audio inside a .mp4 container.

    Yes, .mkv would be an alternative container which supports flac as audio stream.


    Cu Selur
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  3. Originally Posted by Selur View Post
    Yes, the .mp4 container does not support flac. Normally you would use alac when going for lossless audio inside a .mp4 container.

    Yes, .mkv would be an alternative container which supports flac as audio stream.


    Cu Selur
    Thanks.

    MKV is not so common on internet esp. on WhatsApp.
    Sword is no substitute for kitchen-knife.
    Quote Quote  
  4. DECEASED
    Join Date
    Jun 2009
    Location
    Heaven
    Search Comp PM
    Besides ALAC, you could use MPEG4ALS or TrueHD.
    MPEG4ALS should be okay, but the TrueHD generated by ffmpeg is not very "loyal to the specifications", to say the least.
    "Programmers are human-shaped machines that transform alcohol into bugs."
    Quote Quote  
  5. ffmpeg has no MPEG-4 ALS encoder, only decoding support. -> is there a free MPEG-4 ALS encoder around?
    Also is there an alternative free TrueHD encoder?
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  6. DECEASED
    Join Date
    Jun 2009
    Location
    Heaven
    Search Comp PM
    Originally Posted by Selur View Post
    ffmpeg has no MPEG-4 ALS encoder, only decoding support. -> is there a free MPEG-4 ALS encoder around?
    MPEG-4 ALS codec for Windows - mp4alsRM23.exe

    https://www.nue.tu-berlin.de/menue/forschung/forschungsgebiete/datenkompression_und_ue.../parameter/en/
    "Programmers are human-shaped machines that transform alcohol into bugs."
    Quote Quote  
  7. nice
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  8. Member
    Join Date
    Aug 2006
    Location
    United States
    Search Comp PM
    Originally Posted by ConverterCrazy View Post
    MKV is not so common on internet esp. on WhatsApp.
    Support for ALAC is good but not universal. For example Airpods support AAC but not ALAC.

    You may not like AAC audio but if sticking with what is common is important to you, AVC + AAC probably has the best support and is the most typical combination of audio and video for the mp4 container.

    Odd that WhatsApp seems not to provide any guidelines beyond a 16 MB size limit for each video.
    Ignore list: hello_hello, tried, TechLord, Snoopy329
    Quote Quote  
  9. Originally Posted by usually_quiet View Post
    Originally Posted by ConverterCrazy View Post
    MKV is not so common on internet esp. on WhatsApp.
    Support for ALAC is good but not universal. For example Airpods support AAC but not ALAC.

    You may not like AAC audio but if sticking with what is common is important to you, AVC + AAC probably has the best support and is the most typical combination of audio and video for the mp4 container.

    Odd that WhatsApp seems not to provide any guidelines beyond a 16 MB size limit for each video.
    Thanks. I will stick with AVC+AAC.

    There is another issue with WhatsApp - I get huge video files 3-4 times of the limit of 16MB from my contacts but, I am not able to send any video larger than 16MB! But that's another issue.
    Sword is no substitute for kitchen-knife.
    Quote Quote  
  10. Originally Posted by El Heggunte View Post
    Originally Posted by Selur View Post
    ffmpeg has no MPEG-4 ALS encoder, only decoding support. -> is there a free MPEG-4 ALS encoder around?
    MPEG-4 ALS codec for Windows - mp4alsRM23.exe

    https://www.nue.tu-berlin.de/menue/forschung/forschungsgebiete/datenkompression_und_ue.../parameter/en/
    Thanks.

    What ffmpeg command shall I use for this codec for a single file and in batch?
    [video=copy, audio=MP4ALS]
    Sword is no substitute for kitchen-knife.
    Quote Quote  
  11. ffmpeg only can decode mpeg4 als not encode it. The only encoder I'm aware of is the mentioned encoder.
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  12. Originally Posted by Selur View Post
    ffmpeg only can decode mpeg4 als not encode it. The only encoder I'm aware of is the mentioned encoder.
    Sorry.

    How do I use this command to create an MP4 file with the video track[AVC] and audio track [.wav]?

    Can you give an example which I may use?
    Sword is no substitute for kitchen-knife.
    Quote Quote  
  13. Member
    Join Date
    Mar 2008
    Location
    United States
    Search Comp PM
    If it's acceptable, use mov instead of mp4
    Quote Quote  
  14. You can't use wav/pcm audio since .mp4 does not support wav/pcm audio.
    (sometimes folks mux their content to .mov and rename it to .mp4 and clain they got a .mp4 files which contains wav/pcm, but that is not the case)
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  15. Originally Posted by Selur View Post
    You can't use wav/pcm audio since .mp4 does not support wav/pcm audio.
    (sometimes folks mux their content to .mov and rename it to .mp4 and clain they got a .mp4 files which contains wav/pcm, but that is not the case)
    You mean mp4alsRM23.exe will not convert a [.wav] to mp4als file?

    I got the impression that it will and then mux it with the AVC video track.
    Last edited by ConverterCrazy; 13th Oct 2021 at 13:46. Reason: Additional info
    Sword is no substitute for kitchen-knife.
    Quote Quote  
  16. No, mp4alsRM23 should be able to convert wav/pmc to mp4 als.

    the help:
    Code:
    mp4alsRM23.exe -h
    lists the options it has and even shows examples on how to use it.
    Code:
    mp4alsRM23 - MPEG-4 Audio Lossless Coding (ALS), Reference Model Codec
      Version 23 for Win32
      (c) 2003-2008 Tilman Liebchen, TU Berlin / LG Electronics
        E-mail: liebchen@nue.tu-berlin.de
      Portions by Yuriy A. Reznik, RealNetworks, Inc.
        E-mail: yreznik@real.com
      Portions by Koichi Sugiura, NTT Advanced Technology corporation
        E-mail: koichi.sugiura@ntt-at.co.jp
      Portions by Takehiro Moriya, Noboru Harada and Yutaka Kamamoto, NTT
        E-mail: {moriya.takehiro,harada.noboru,kamamoto.yutaka}@lab.ntt.co.jp
    
    Usage: mp4alsRM23 [options] infile [outfile]
    
      In compression mode, infile must be a PCM file (wav, aif, or raw format)
      or a 32-bit floating point file (normalized, wav format type 3).
      Mono, stereo, and multichannel files with up to 65536 channels and up to
      32-bit resolution are supported at any sampling frequency.
      In decompression mode (-x), infile is the compressed file (.als or .mp4).
      If outfile is not specified, the name of the output file will be generated
      by replacing the extension of the input file (wav <-> als).
      If outfile is '-', the output will be written to stdout. If infile is '-',
      the input will be read from stdin, and outfile has to be specified.
    
    General Options:
      -c  : Check accuracy by decoding the whole file after encoding.
      -d  : Delete input file after completion.
      -h  : Help (this message)
      -v  : Verbose mode (file info, processing time)
      -x  : Extract (all options except -v and -MP4 are ignored)
    Encoding Options:
      -7  : Set parameters for optimum compression (except LTP, MCC, RLSLMS)
      -a  : Adaptive prediction order
      -b  : Use BGMC codes for prediction residual (default: use Rice codes)
      -e  : Exclude CRC calculation
      -f# : ACF/MLZ mode: # = 0-7, -f6/-f7 requires ACF gain value
      -g# : Block switching level: 0 = off (default), 5 = maximum
      -i  : Independent stereo coding (turn off joint stereo coding)
      -l  : Check for empty LSBs (e.g. 20-bit files)
      -m# : Rearrange channel configuration (example: -m1,2,4,5,3)
      -n# : Frame length: 0 = auto (default), max = 65536
      -o# : Prediction order (default = 10), max = 1023
      -p  : Use long-term prediction
      -r# : Random access (multiples of 0.1 sec), -1 = each frame, 0 = off (default)
      -s# : Multi-channel correlation (#=1-65536, jointly code every # channels)
            # must be a divisor of number of channels, otherwise -s is ignored
      -sp#: Enforce ALS Simple Profile Level # (currently only #=1 is defined)
      -t# : Two methods mode (Joint Stereo and Multi-channel correlation)
            # must be a divisor of number of channels
      -u# : Random access info location, 0 = frames (default), 1 = header, 2 = none
      -z# : RLSLMS mode (default = 0: no RLSLMS mode,  1-quick, 2-medium 3-best )
    MP4 File Format Support:
      -MP4: Use MP4 file format for compressed file (default if extension is .mp4)
      -OAFI:Force to embed meta box with oafi record
      -npi: Do not indicate the conformant profiles in the MP4 file
    Audio file support:
      -R  : Raw audio file (use -C, -W, -F and -M to specify format)
      -S# : Sample type: 0 = integer (default), 1 = float
      -C# : Number of Channels (default = 2)
      -W# : Word length in bits per sample (default = 16)
      -F# : Sampling frequency in Hz (default = 44100)
      -M  : 'MSByte first' byte order (otherwise 'LSByte first')
      -H# : Header size in bytes (default = 0)
      -T# : Trailer size in bytes (default = 0)
      -I  : Show info only, no (de)compression (add -x for compressed files)
    
    Examples:
      mp4alsRM23 -v sound.wav
      mp4alsRM23 -n1024 -i -o20 sound.wav
      mp4alsRM23 - sound.als < sound.wav
      mp4alsRM23 -x sound.als
      mp4alsRM23 -x sound.als - > sound.wav
      mp4alsRM23 -I -x sound.als
    You could either create a .als or a .mp4 file as output and that output and your video stream could be muxed using ffmpeg.
    Since I have never used mp4alsRM23 I can't recommend any settings.

    Cu Selur
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  17. Member Cornucopia's Avatar
    Join Date
    Oct 2001
    Location
    Deep in the Heart of Texas
    Search PM
    Yes, that compressed output is an audio-only stream in an mp4 container (aka m4a, m4b, like aac often is), or a raw .als elementary stream, so an extra step of muxing it with the video stream will be necessary.

    Scott
    Quote Quote  
  18. Member
    Join Date
    Mar 2008
    Location
    United States
    Search Comp PM
    Interesting, Avidemux allows the saving of WAV in mov, but not in mp4
    Quote Quote  
  19. Different containers, different supported stream formats, nothing new.
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!