#9311 closed defect (invalid)
FLAC works in MP4 container but not in M4A
Reported by: | MAProsper | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | avformat |
Version: | git-master | Keywords: | flac mov |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
Summary of the bug:
FFmpeg can produce and process MP4s with FLAC audio but can't do the same if the desination is a M4A (or M4B), which from what I understand is basiclly the same container, so it should also be supported.
How to reproduce:
Create a MP4 with FLAC audio, works fine.
% ffmpeg -i audio.flac -strict experimental -codec copy sample.mp4 ffmpeg version N-57736-ga501d55905-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2021 the FFmpeg developers built with gcc 8 (Debian 8.3.0-6) configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg libavutil 57. 0.100 / 57. 0.100 libavcodec 59. 1.101 / 59. 1.101 libavformat 59. 3.100 / 59. 3.100 libavdevice 59. 0.100 / 59. 0.100 libavfilter 8. 0.102 / 8. 0.102 libswscale 6. 0.100 / 6. 0.100 libswresample 4. 0.100 / 4. 0.100 libpostproc 56. 0.100 / 56. 0.100 Input #0, flac, from audio.flac': Metadata: ALBUM : title TITLE : title track : 01 TRACKTOTAL : 01 CDDB : 00000000 Duration: 00:39:14.25, start: 0.000000, bitrate: 966 kb/s Chapters: Chapter #0:0: start 0.000000, end 2354.253333 Metadata: title : Stream #0:0: Audio: flac, 44100 Hz, stereo, s16 [mp4 @ 0x7377b80] track 0: codec frame size is not set Output #0, mp4, to 'sample.mp4': Metadata: ALBUM : title TITLE : title track : 01 TRACKTOTAL : 01 CDDB : 7b09321b encoder : Lavf59.3.100 Chapters: Chapter #0:0: start 0.000000, end 2354.253333 Metadata: title : Stream #0:0: Audio: flac (fLaC / 0x43614C66), 44100 Hz, stereo, s16 Stream mapping: Stream #0:0 -> #0:0 (copy) size= 277701kB time=00:39:14.22 bitrate= 966.3kbits/s speed=3.26e+03x video:0kB audio:277596kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.037897%
Create a M4A with FLAC audio, from the same source file, doesn't work.
% ffmpeg -i audio.flac -strict experimental -codec copy sample.m4a ffmpeg version N-57736-ga501d55905-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2021 the FFmpeg developers built with gcc 8 (Debian 8.3.0-6) configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg libavutil 57. 0.100 / 57. 0.100 libavcodec 59. 1.101 / 59. 1.101 libavformat 59. 3.100 / 59. 3.100 libavdevice 59. 0.100 / 59. 0.100 libavfilter 8. 0.102 / 8. 0.102 libswscale 6. 0.100 / 6. 0.100 libswresample 4. 0.100 / 4. 0.100 libpostproc 56. 0.100 / 56. 0.100 Input #0, flac, from 'audio.flac': Metadata: ALBUM : title TITLE : title track : 01 TRACKTOTAL : 01 CDDB : 00000000 Duration: 00:39:14.25, start: 0.000000, bitrate: 966 kb/s Chapters: Chapter #0:0: start 0.000000, end 2354.253333 Metadata: title : Stream #0:0: Audio: flac, 44100 Hz, stereo, s16 [ipod @ 0x62b2b80] Could not find tag for codec flac in stream #0, codec not currently supported in container Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument Error initializing output stream 0:0 -- Stream mapping: Stream #0:0 -> #0:0 (copy) Last message repeated 1 times
Change History (5)
comment:1 by , 3 years ago
Component: | ffmpeg → avformat |
---|---|
Keywords: | mov added; mp4 m4a removed |
Resolution: | → invalid |
Status: | new → closed |
comment:2 by , 3 years ago
Hi Carl, thanks for the quick replay. I seen other tickets that go on for years, so it is higly appreciated. However I have several doubts maybe you, bing part of the project, may be able to answer.
Everywhere I read MP4 is referred to as MPEG-4 part 14, which is a container specification under the open standard MPEG-4. Which also defines several other file extensions for diferent use cases, one of them is M4A, which is usally used for MPEG-4 part 14 containers with only audio. So I was under the impresion that since FLAC is now suported in MP4 (MPEG-4 part 14), and M4A is the same container, it should also be suported.
Additionally, I do not understand the reasoning behind the Apple support comment, since I thought that was up to the audio/video players. Plus, if one OS does not support it, that not a reason to hold back the others.
Finally, the removal of the MP4 and M4A tags seems strange, as that was the topic of the ticket. Not to mention the addition of MOV, which was never discussed.
Regards.
comment:4 by , 3 years ago
Hi Carl, thanks again for that simple comment. Those doble equals definetly did wonders. Now I understand it alot better, or at least that is what I think.
So MPEG-4 (MP4) was based on the QuickTime (MOV) file format, that solve my misconception created due to the amount of similar information I found. Surprisingly there is very little about their realtion, but enough to understand it.
Continuing with the rabbit hole of research; I found out Apple does in fact support FLAC, at least since macOS 10.13 according to the WWDC 2017 and Wikipedia. However since I clearly have some gaps of knowlage in the topic it might be better left alone.
So to finish this of, if you select M4A even if it both formats share the extension, FFmpeg will follow the QuickTime standard over MPEG-4.
Thanks a third time for all this information and hope you have a great day sir.
comment:5 by , 3 years ago
Strange issue, just create mp4 and rename to m4a. They should be the same, except for brand. Also, it is wrong to put FLAC in mp4, use normal encoder that supports SEEKTABLE. I mean this one, https://github.com/xiph/flac/issues (there is a bug in xiph/flac encoder that slows encoding down with SEEKTABLE, but whatever).
(I am not sure about version 2 mp4 and stuff.)
Apple devices do not support flac / m4a is not mp4.