[FFmpeg-devel] Request: consider use codec id "sowt" instead of "ipcm" for LPCM_S16LE in mp4 muxer

Joseph Chris joseph at josephcz.xyz
Wed May 24 03:45:43 EEST 2023


Hello,

I am writing this mail for request consider use codec id "sowt" instead 
of "ipcm" for AV_CODEC_ID_PCM_S16LE in mp4 muxer, and 
AV_CODEC_ID_PCM_S16BE accordingly. This only needs a minor change on code:

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index a9c8e104f0..2b984789f5 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -7816,6 +7816,9 @@ static const AVCodecTag codec_mp4_tags[] = {
      { AV_CODEC_ID_TTML,            MOV_MP4_TTML_TAG          },
      { AV_CODEC_ID_TTML,            MOV_ISMV_TTML_TAG         },

+    // To improve compatibility
+    { AV_CODEC_ID_PCM_S16BE,       MKTAG('t', 'w', 'o', 's') },
+    { AV_CODEC_ID_PCM_S16LE,       MKTAG('s', 'o', 'w', 't') },
      /* ISO/IEC 23003-5 integer formats */
      { AV_CODEC_ID_PCM_S16BE,       MOV_MP4_IPCM_TAG          },
      { AV_CODEC_ID_PCM_S16LE,       MOV_MP4_IPCM_TAG          },


Many players like VLC and potplayer, can recognize "sowt", but they can 
not recognize "ipcm" or "lpcm" (lpcm is defined on mp4ra). Even ffmpeg 
it self (current git master, d81558) can't recognize it. So this change 
can improve compatibility and interoperability of ffmpeg.

This change is related to #9219 and #10185.

This change fails fate-mov-mp4-pcm but passes all other tests. 
fate-mov-mp4-pcm checks the MD5 of output file, as the codec id changes 
also makes the MD5 change. So we have to rewrite the test while changing 
the code.


More information about the ffmpeg-devel mailing list