[FFmpeg-devel] [PATCH 7/8] avformat/mpegtsenc: add registration descriptor for AC-3 and EAC3

lance.lmwang at gmail.com lance.lmwang at gmail.com
Wed Jul 22 18:27:38 EEST 2020


From: Limin Wang <lance.lmwang at gmail.com>

copy the atsc ac3 audio in ts like below:
./ffmpeg -i atsc_audio.ts -c:v copy -c:a copy out.ts
Stream #0:6[0x64](eng): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 192 kb/s

./ffmpeg -i out.ts
Before:
Stream #0:1[0x101](eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, stereo, fltp, 192 kb/s

After applied patch:
Stream #0:1[0x101](eng): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 192 kb/s

Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
---
 libavformat/mpegtsenc.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index a5b45fb..f060ea6 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -535,6 +535,11 @@ static int mpegts_write_pmt(AVFormatContext *s, MpegTSService *service)
                     *q++=1; // 1 byte, all flags sets to 0
                     *q++=0; // omit all fields...
                 }
+            } else {
+                if (codec_id == AV_CODEC_ID_AC3)
+                    put_registration_descriptor(&q, MKTAG('A', 'C', '-', '3'));
+                else if (codec_id == AV_CODEC_ID_EAC3)
+                    put_registration_descriptor(&q, MKTAG('E', 'A', 'C', '3'));
             }
             if (codec_id == AV_CODEC_ID_S302M)
                 put_registration_descriptor(&q, MKTAG('B', 'S', 'S', 'D'));
-- 
1.8.3.1



More information about the ffmpeg-devel mailing list