Discussion:
[FFmpeg-user] Transport Stream Descriptors
Marcelo Boufleur
2016-09-08 16:44:18 UTC
Permalink
Hello everyone,

I am using ffmpeg to remultiplex some MPEG-2 Transport Stream content, but
the audio tracks in the resulting file seem to miss some of the original
information and/or descriptors.

Below is the original file, read by ffmpeg

C:\>ffmpeg -i 0593000000000096_movie.mpg
ffmpeg version N-80980-g7af44ce Copyright (c) 2000-2016 the FFmpeg
developers
built with gcc 5.4.0 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-dxva2 --enable-libmfx
--enable-nvenc --enable-avisynth --enable-bzlib --enable-libebur128
--enable-fontconfig --enable-fre
i0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray
--enable-libbs2b --enable-libc
aca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc
--enable-libmodplug --enab
le-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-libopenjpeg --enable-li
bopus --enable-librtmp --enable-libschroedinger --enable-libsnappy
--enable-libsoxr --enable-libspee
x --enable-libtheora --enable-libtwolame --enable-libvidstab
--enable-libvo-amrwbenc --enable-libvor
bis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264
--enable-libx265 --enable-
libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink
--enable-zlib
libavutil 55. 28.100 / 55. 28.100
libavcodec 57. 50.100 / 57. 50.100
libavformat 57. 41.100 / 57. 41.100
libavdevice 57. 0.102 / 57. 0.102
libavfilter 6. 47.100 / 6. 47.100
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 1.100 / 2. 1.100
libpostproc 54. 0.100 / 54. 0.100
Input #0, mpegts, from '0593000000000096_movie.mpg':
Duration: 00:13:17.98, start: 0.400400, bitrate: 55023 kb/s
Program 1
Stream #0:0[0x1e1]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002),
yuv420p(tv), 1920x1080 [SAR 1:1 DAR 16:9], Closed Captions, 50000 kb/s,
29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
Stream #0:1[0x1e2](por): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz,
stereo, fltp, 448 kb/s
Stream #0:2[0x1e3](por): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz,
stereo, fltp, 448 kb/s
At least one output file must be specified

The file is then remultiplexed using this command

C:\>ffmpeg -i 0593000000000096_movie.mpg -map 0:0 -map 0:1 -map 0:2 -c:v
copy -c:a copy -f mpegts OUTPUT.ts

The resulting file is again read by ffmpeg with the following command

C:\>ffmpeg -i OUTPUT.ts
ffmpeg version N-80980-g7af44ce Copyright (c) 2000-2016 the FFmpeg
developers
built with gcc 5.4.0 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-dxva2 --enable-libmfx
--enable-nvenc --enable-avisynth --enable-bzlib --enable-libebur128
--enable-fontconfig --enable-fre
i0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray
--enable-libbs2b --enable-libc
aca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc
--enable-libmodplug --enab
le-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-libopenjpeg --enable-li
bopus --enable-librtmp --enable-libschroedinger --enable-libsnappy
--enable-libsoxr --enable-libspee
x --enable-libtheora --enable-libtwolame --enable-libvidstab
--enable-libvo-amrwbenc --enable-libvor
bis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264
--enable-libx265 --enable-
libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink
--enable-zlib
libavutil 55. 28.100 / 55. 28.100
libavcodec 57. 50.100 / 57. 50.100
libavformat 57. 41.100 / 57. 41.100
libavdevice 57. 0.102 / 57. 0.102
libavfilter 6. 47.100 / 6. 47.100
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 1.100 / 2. 1.100
libpostproc 54. 0.100 / 54. 0.100
Input #0, mpegts, from 'OUTPUT.ts':
Duration: 00:13:17.98, start: 1.433367, bitrate: 54920 kb/s
Program 1
Metadata:
service_name : Service01
service_provider: FFmpeg
Stream #0:0[0x100]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002),
yuv420p(tv), 1920x1080 [SAR 1:1 DAR 16:9], Closed Captions, 50000 kb/s,
29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
Stream #0:1[0x101](por): Audio: ac3 ([129][0][0][0] / 0x0081), 48000
Hz, stereo, fltp, 448 kb/s
Stream #0:2[0x102](por): Audio: ac3 ([129][0][0][0] / 0x0081), 48000
Hz, stereo, fltp, 448 kb/s
At least one output file must be specified

To better see the difference, I will put both audio stdout infos from the
fist audio track down here (Original & Remultiplexed):

Stream #0:1[0x1e2](por): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz,
stereo, fltp, 448 kb/s
Stream #0:1[0x101](por): Audio: ac3 ([129][0][0][0] / 0x0081), 48000
Hz, stereo, fltp, 448 kb/s

The first information within the square brackest is the PID, and the
information within the first parenthesis block is the language defined by
ISO639 Language Descriptor (with the 0x0A descriptor value)
My main concern is the information that ffmpeg shows within the second
parenthesis which would be the other descriptors. They somehow are changed
by ffmpeg.

The informations within the second parenthesis of the first original audio
track seem to be the following:
AC-3: User Private Descriptor (having the value of 0x81)
0x332D4341: Registration Descriptor (this value also seems to be the format
identifier of AC-3)

The informations within the second parenthesis of the second original audio
track are as follows:
[129][0][0][0] - No sure what is relates to, but 129 decimal is equal to
0x81
0x0081 - Again, the 0x81 value, but not associated with any descriptor

The information about the descriptors from the first file above I was able
to retrieve by looking the same original file in TSReader application.
The OUTPUT.ts file exported by ffmpeg only shows the descriptor for the
ISO639 Language descriptor, so I am not sure what these informations
"[129][0][0][0]" or "0x0081" stand for.

Does anyone would know how I would be able to re-create these audio
descriptors with ffmpeg? There are cases when I would like to also
multiplex separate audio files, so it would be nice to now about any
options in ffmpeg command line to achieve that.

There are some cases when AC-3 audio also uses 0x06 as User Private
Descriptor (which can be used for audio and/or subtitles), instead of 0x81,
so if this also would be possible to define, it would be great.



Marcelo
_______________________________________________
ffmpeg-user mailing list
ffmpeg-***@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-us
Carl Eugen Hoyos
2016-09-08 17:15:52 UTC
Permalink
Post by Marcelo Boufleur
There are some cases when AC-3 audio also uses 0x06 as User Private
Descriptor (which can be used for audio and/or subtitles), instead of
0x81, so if this also would be possible to define, it would be great.
Use "-mpegts_flags +system_b" to get Private Descriptor 0x06.
(0x81 is ATSC for AC-3)

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
ffmpeg-***@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ff
Marcelo Boufleur
2016-09-08 19:51:19 UTC
Permalink
Post by Carl Eugen Hoyos
Use "-mpegts_flags +system_b" to get Private Descriptor 0x06.
(0x81 is ATSC for AC-3)
Thank you Carl Eugen, the "-mpegts_flags +system_b" option does apply a
descriptor of 0x6 to the audio tracks as per DVB specs. However, I would
still like to go back to ATSC version and try to recreate the original
descriptors. We can see the below example for the three samples I am
working right now:

Stream #0:1[0x1e2](por): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz,
stereo, fltp, 448 kb/s
Stream #0:1[0x101](por): Audio: ac3 ([129][0][0][0] / 0x0081), 48000
Hz, stereo, fltp, 448 kb/s
Stream #0:1[0x101](por): Audio: ac3 ([6][0][0][0] / 0x0006), 48000 Hz,
stereo, fltp, 448 kb/s

First is the original sample, second is the ffmpeg ATSC remux version,
third is ffmpeg DVB remux version.

I am using a free app called DemuxToy to further analyse these files and
see exactly what is different after the ffmpeg remultiplex procedure. Below
you may find the results:

=== ORIGINAL FILE ===
• PAT
• TableId:0x00
• SectionSyntaxIndicator:1
• PID:0x0000
• TransportStreamId:0x0000
• VersionNumber:0
• ValidNow:TRUE
• TotalSections:1
• TotalExpectedSections:1
• TotalBytes:16
• TotalPrograms:1
• ProgramMaps
| +- • Map
| +- • ProgramNumber:1
| +- • PID:0x01E0
• CRC:OK

• PMT program:1
• TableId:0x02
• SectionSyntaxIndicator:1
• PID:0x01E0
• ProgramNumber:1
• VersionNumber:0
• ValidNow:TRUE
• TotalSections:1
• TotalExpectedSections:1
• TotalBytes:71
• PcrPid:0x01E1
• hasRCT:FALSE
• hasInteractiveApp:FALSE
• hasMetadata:FALSE
• DescriptorLoop
• ElementaryStreams
| +- • ES (Track Video 1)
| | +- • StreamType:MPEG-2 Video Stream (0x2)
| | +- • ElementaryPID:0x01E1
| | +- • DescriptorLoop
| |
| +- • ES (Track Audio 1)
| | +- • StreamType:User Private Stream (0x81)
| | +- • ElementaryPID:0x01E2
| | +- • DescriptorLoop
| | + Descriptor
| | | +- • Tag:RegistrationDescriptor (0x05)
| | | +- • Lenght:4
| | | +- • Content
| | | +- • FormatIdentifier:AC-3 (0x41432D33)
| | | +- • AdditionalIdentificationInfo:
| | |
| | + Descriptor
| | | +- • Tag:ATSC AC3Descriptor (0x81)
| | | +- • Lenght:6
| | | +- • Content
| | | +- • Bytes: 0x08,0x3C,0x05,0x00,0x1F,0x01
| | |
| | + Descriptor
| | +- • Tag:ISO639LanguageDescriptor (0x0A)
| | +- • Lenght:4
| | +- • Content
| | +- • Language
| | +- • LanguageCode:eng
| | +- • AudioType:Undefinied (0)
| |
| +- • ES (Track Audio 2)
| +- • StreamType:User Private Stream (0x81)
| +- • ElementaryPID:0x01E3
| +- • DescriptorLoop
| + Descriptor
| | +- • Tag:RegistrationDescriptor (0x05)
| | +- • Lenght:4
| | +- • Content
| | +- • FormatIdentifier:AC-3 (0x41432D33)
| | +- • AdditionalIdentificationInfo:
| |
| + Descriptor
| | +- • Tag:ATSC AC3Descriptor (0x81)
| | +- • Lenght:6
| | +- • Content
| | +- • Bytes: 0x08,0x3C,0x05,0x00,0x1F,0x01
| |
| + Descriptor
| +- • Tag:ISO639LanguageDescriptor (0x0A)
| +- • Lenght:4
| +- • Content
| +- • Language
| +- • LanguageCode:por
| +- • AudioType:Undefinied (0)
• CRC:OK


=== FFMPEG WITH ATSC REMUX ===
• SDT
• TableId:0x42
• SectionSyntaxIndicator:1
• PID:0x0011
• TransportStreamId:0x0001
• VersionNumber:0
• ValidNow:TRUE
• OriginalNetworkId:0xFF01
• TotalSections:1
• TotalExpectedSections:1
• TotalBytes:40
• TotalServices:1
• ServicesLoop
| +- • Service
| +- • ServiceId:1
| +- • EITScheduleFlag:0
| +- • EITpf:0
| +- • RunningStatus:running(4)
| +- • ServiceType:digital television service (0x01)
| +- • FreeCA:not scrambled (0)
| +- • DescriptorLoop
| + Descriptor
| +- • Tag:ServiceDescriptor (0x48)
| +- • Lenght:18
| +- • Content
| +- • Type:digital television service (0x01)
| +- • ProviderName
| | +- • ShortName:
| | +- • Name:FFmpeg
| +- • ServiceName
| +- • ShortName:
| +- • Name:Service01
• CRC:OK

• PAT
• TableId:0x00
• SectionSyntaxIndicator:1
• PID:0x0000
• TransportStreamId:0x0001
• VersionNumber:0
• ValidNow:TRUE
• TotalSections:1
• TotalExpectedSections:1
• TotalBytes:16
• TotalPrograms:1
• ProgramMaps
| +- • Map
| +- • ProgramNumber:1
| +- • PID:0x1000
• CRC:OK

• PMT program:1
• TableId:0x02
• SectionSyntaxIndicator:1
• PID:0x1000
• ProgramNumber:1
• VersionNumber:0
• ValidNow:TRUE
• TotalSections:1
• TotalExpectedSections:1
• TotalBytes:43
• PcrPid:0x0100
• hasRCT:FALSE
• hasInteractiveApp:FALSE
• hasMetadata:FALSE
• DescriptorLoop
• ElementaryStreams
| +- • ES (Track Video 1)
| | +- • StreamType:MPEG-2 Video Stream (0x2)
| | +- • ElementaryPID:0x0100
| | +- • DescriptorLoop
| |
| +- • ES (Track Audio 1)
| | +- • StreamType:User Private Stream (0x81)
| | +- • ElementaryPID:0x0101
| | +- • DescriptorLoop
| | + Descriptor
| | +- • Tag:ISO639LanguageDescriptor (0x0A)
| | +- • Lenght:4
| | +- • Content
| | +- • Language
| | +- • LanguageCode:eng
| | +- • AudioType:Undefinied (0)
| |
| +- • ES (Track Audio 2)
| +- • StreamType:User Private Stream (0x81)
| +- • ElementaryPID:0x0102
| + Descriptor
| +- • Tag:ISO639LanguageDescriptor (0x0A)
| +- • Lenght:4
| +- • Content
| +- • Language
| +- • LanguageCode:por
| +- • AudioType:Undefinied (0)
• CRC:OK


=== FFMPEG WITH DVB REMUX ===
• SDT
• TableId:0x42
• SectionSyntaxIndicator:1
• PID:0x0011
• TransportStreamId:0x0001
• VersionNumber:0
• ValidNow:TRUE
• OriginalNetworkId:0xFF01
• TotalSections:1
• TotalExpectedSections:1
• TotalBytes:40
• TotalServices:1
• ServicesLoop
| +- • Service
| +- • ServiceId:1
| +- • EITScheduleFlag:0
| +- • EITpf:0
| +- • RunningStatus:running(4)
| +- • ServiceType:digital television service (0x01)
| +- • FreeCA:not scrambled (0)
| +- • DescriptorLoop
| + Descriptor
| +- • Tag:ServiceDescriptor (0x48)
| +- • Lenght:18
| +- • Content
| +- • Type:digital television service (0x01)
| +- • ProviderName
| | +- • ShortName:
| | +- • Name:FFmpeg
| +- • ServiceName
| +- • ShortName:
| +- • Name:Service01
• CRC:OK

• PAT
• TableId:0x00
• SectionSyntaxIndicator:1
• PID:0x0000
• TransportStreamId:0x0001
• VersionNumber:0
• ValidNow:TRUE
• TotalSections:1
• TotalExpectedSections:1
• TotalBytes:16
• TotalPrograms:1
• ProgramMaps
| +- • Map
| +- • ProgramNumber:1
| +- • PID:0x1000
• CRC:OK

• PMT program:1
• TableId:0x02
• SectionSyntaxIndicator:1
• PID:0x1000
• ProgramNumber:1
• VersionNumber:0
• ValidNow:TRUE
• TotalSections:1
• TotalExpectedSections:1
• TotalBytes:49
• PcrPid:0x0100
• hasRCT:FALSE
• hasInteractiveApp:FALSE
• hasMetadata:FALSE
• DescriptorLoop
• ElementaryStreams
| +- • ES (Track Video 1)
| | +- • StreamType:MPEG-2 Video Stream (0x2)
| | +- • ElementaryPID:0x0100
| | +- • DescriptorLoop
| |
| +- • ES (Track Audio 1)
| | +- • StreamType:MPEG-2 PES Packets Private Data (0x6)
| | +- • ElementaryPID:0x0101
| | +- • DescriptorLoop
| | + Descriptor
| | | +- • Tag:AC3Descriptor(0x06A)
| | | +- • Lenght:1
| | | +- • Content
| | | +- • ComponentTypeFlag:FALSE
| | | +- • BsidFlag:FALSE
| | | +- • MainidFlag:FALSE
| | | +- • AsvcFlag:FALSE
| | | +- • Bsid:
| | | +- • AdditionalInfoBytes:
| | |
| | + Descriptor
| | +- • Tag:ISO639LanguageDescriptor (0x0A)
| | +- • Lenght:4
| | +- • Content
| | +- • Language
| | +- • LanguageCode:eng
| | +- • AudioType:Undefinied (0)
| |
| +- • ES (Track Audio 2)
| +- • StreamType:MPEG-2 PES Packets Private Data (0x6)
| +- • ElementaryPID:0x0102
| +- • DescriptorLoop
| + Descriptor
| | +- • Tag:AC3Descriptor(0x06A)
| | +- • Lenght:1
| | +- • Content
| | +- • ComponentTypeFlag:FALSE
| | +- • BsidFlag:FALSE
| | +- • MainidFlag:FALSE
| | +- • AsvcFlag:FALSE
| | +- • Bsid:
| | +- • AdditionalInfoBytes:
| |
| + Descriptor
| +- • Tag:ISO639LanguageDescriptor (0x0A)
| +- • Lenght:4
| +- • Content
| +- • Language
| +- • LanguageCode:por
| +- • AudioType:Undefinied (0)
• CRC:OK
_______________________________________________
ffmpeg-user mailing list
ffmpeg-***@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-us
Carl Eugen Hoyos
2016-09-09 15:54:39 UTC
Permalink
I would still like to go back to ATSC version and try to
recreate the original descriptors.
Iirc, this is not possible (there may have been a patch once,
not sure), patch probably welcome!

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
ffmpeg-***@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-***@ffmpeg.org with subject "unsubscr
Marcelo Boufleur
2016-09-09 18:46:23 UTC
Permalink
Post by Carl Eugen Hoyos
Iirc, this is not possible (there may have been a patch once,
not sure), patch probably welcome!
Track #5837 created, thank you Carl Eugen.
_______________________________________________
ffmpeg-user mailing list
ffmpeg-***@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg

Continue reading on narkive:
Loading...