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

Marton Balint cus at passwd.hu
Sun Aug 23 16:04:10 EEST 2020



On Sun, 23 Aug 2020, lance.lmwang at gmail.com wrote:

> On Sun, Aug 23, 2020 at 10:17:01AM +0200, Marton Balint wrote:
>> 
>> 
>> On Sun, 23 Aug 2020, lance.lmwang at gmail.com wrote:
>> 
>> > On Sat, Aug 22, 2020 at 07:27:30PM +0200, Marton Balint wrote:
>> > > 
>> > > 
>> > > On Sat, 22 Aug 2020, lance.lmwang at gmail.com wrote:
>> > > 
>> > > > On Wed, Jul 22, 2020 at 11:27:38PM +0800, lance.lmwang at gmail.com wrote:
>> > > > > 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
>> > > > > > > ping the patch, as I'll submit patch to support atsc ac3
>> > > descriptor after that.
>> > > 
>> > > Why is this patch needed?
>> > > 
>> > > https://www.atsc.org/wp-content/uploads/2015/03/A52-2018-1.pdf
>> > > 
>> > > does not seem to require the use of MPEG2 registration descriptor for ATSC.
>> > > 
>> > > I am not saying this is patch is bad, but some valid reason should be found
>> > > to justify it, and the fact that AC3 fourcc is reported is irrelevant, that
>> > > is just fourcc, it can be anything.
>> > 
>> > Most of my atsc ac3 sample write the mpeg2 descriptor, so I want to keep it when copy
>> > the audio stream.
>> 
>> There are system B samples out there which also has the descriptor. So why
>> not write it to system B as well by that reasoning?
>
> Where to download such samples, most of my system sample don't write the
> mpeg2 descriptor, that's why I haven't add it for system B.

A lot of samples are in http://samples.ffmpeg.org:

MPEG2/subcc/HK_DVB_w_subtitle.ts
MPEG2/subcc/HK_DVB_sample.ts
ffmpeg-bugs/trac/ticket2086/teletextsubtitles.ts
ffmpeg-bugs/trac/ticket5453/vlc_cut.ts
ffmpeg-bugs/trac/ticket2838/BDAV recorded video sample.ts
samples/ffmpeg-bugs/trac/ticket3186/Lilyhammer_sample.ts
samples/ffmpeg-bugs/trac/ticket5453/vlc_cut.ts
ffmpeg-bugs/trac/ticket4469/Kodi-Reports-Error-with-DVB-Multilanguage-Subtitles.ts
ffmpeg-bugs/roundup/issue1294/hd_from_ksng_090726b.ts
V-codecs/h264/PAFF/Grey.ts

These should all be 25 fps, so most likely not ATSC...
The Hungarian DVB-T broadcaster also uses the descriptor.

Regards,
Marton


More information about the ffmpeg-devel mailing list