r/ffmpeg • • 5d ago

.mp4

is it possbile .mp4 to support pcm files like .wav and .aiff using -c:a copy?

6 Upvotes

12 comments sorted by

4

u/naemorhaedus 5d ago

is it possbile .mp4 to support pcm files like .wav and .aiff using -c:a copy?

No. supported audio codecs can be reviewed on wikipedia

https://en.wikipedia.org/wiki/MP4_file_format#Data_streams

I don't see a useful reason to use WAV or AIFF anyway. AAC already sounds awesome. If you must insist on lossless, then there are several codecs like that which are supported. WAV/AIFF is incredibly inefficient at storing audio, and that should matter to you in an age where storage comes at a premium.

6

u/_Gyan 5d ago

No. supported audio codecs can be reviewed on wikipedia

PCM support in MP4 was added in Mar 2023.

Don't consult Wikipedia for this. Consult my codecs list at https://www.gyan.dev/ffmpeg/resources/codecs.html. For muxers, look at https://www.gyan.dev/ffmpeg/resources/muxers.html

0

u/naemorhaedus 5d ago edited 5d ago

added in Mar 2023.

... which means that you're guaranteed that no current hardware devices will actually support it, so it's a waste of time. Even though the spec was amended, it's so rarely implemented as to be totally obscure. The whole principle of MP4 is to be a COMPRESSED media container. More relevant to OP's post to this sub though, ffmpeg will reject you if you try. In any case, these are ancient codecs (last millennium), and useless today. MOV and MKV already have historical support using these audio codecs. Nice try with the plug though.

2

u/_Gyan 5d ago

More relevant to OP's post to this sub though, ffmpeg will reject you if you try.

My list shows which ffmpeg muxers accept a codec - it's not a standards/spec list, so if you tried ffmpeg -i pcm_s16_input -c:a copy out.mp4 with a >2023-Mar version, it will succeed.

PCM here refers to LPCM, which is the most common way to represent uncompressed audio. All hardware devices can play LPCM. In fact, that's the only audio format that they can directly render and what encoded audio streams are decoded to, including inside ffmpeg.

2

u/autogyrophilia 5d ago

I defer to your expertise, but while I don't doubt that they can play it, I doubt they can demux it.

4

u/autogyrophilia 5d ago

You probably want to use ALAC if you intend to use lossless audio in MP4 and be it playable with things that aren't FFMPEG based (VLC, MPV) . Otherwise I would either go with MKV as the container or FLAC as the codec.

3

u/_Gyan 5d ago

1

u/Larry-Icy85 4d ago

Also, I looked at Muxer MP4 FFmpeg muxer properties and codec support - codex ffmpeg @ gyan.dev
also I searched for "child muxers: mp4". The only parent muxer (if that is the phrase) is DASH.
Gyan, excellent resource!

-6

u/xylarr 5d ago

I think the .MP4 container can only support MP4 encoded files.

Maybe look at .mkv - you can stuff almost anything into that

9

u/naemorhaedus 5d ago

can only support MP4 encoded files.

mp4 is a container, not a codec