Opened 4 years ago

Closed 4 years ago

#9113 closed enhancement (fixed)

[MPEG-TS] Allow setting the disposition without also setting the language for a track

Reported by: droid-xx Owned by:
Priority: wish Component: undetermined
Version: git-master Keywords: disposition mpegts
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

In MPEG-TS streams the ISO 639 language descriptor holds information about both the language and the audio type (clean effects, hearing impaired, or visual impaired) of a track.

When remuxing to .ts container, if the user sets the language for a track, an ISO 639 language descriptor containing the correct language code and an undefined audio_type is attached to the stream.

Command used:

ffmpeg -i input.ts -map 0 -metadata:s:a:0 language=eng -c copy output.ts

Output from an MPEG-TS stream analyzer regarding the language descriptor of the first audio track:

descriptor_tag=0x0a
descriptor_length=4
ISO_639_language_code=eng
audio_type=0 (Undefined)

If the user sets the language AND the disposition for a track, an ISO 639 language descriptor is created for that track in the output, containing both the passed language code and audio type.

Command used:

ffmpeg -i input.ts -map 0 -metadata:s:a:0 language=eng -disposition:a:0 clean_effects -c copy output.ts

Language descriptor of the first audio track in the output file:

descriptor_tag=0x0a
descriptor_length=4
ISO_639_language_code=eng
audio_type=1 (Clean effects)

However if the user sets only the disposition for a track (without a language), disposition settings are ignored in the output file and there's no language descriptor assigned to the specified track.

Correct behavior would be: if the user sets the disposition for a track, without also setting the language, then proceed to assign a language descriptor with an undefined ISO_639_language_code and an "audio_type" corresponding to the passed disposition (just like what happens when setting only the language, but reverse).

Command used (not working, i.e. no language descriptor assigned to the first audio track):

ffmpeg -i input.ts -map 0 -disposition:a:0 clean_effects -c copy output.ts

Language descriptor that would otherwise be expected in the output:

descriptor_tag=0x0a
descriptor_length=4
ISO_639_language_code=und
audio_type=1 (Clean effects)

Language code is allowed to be undefined, and the "clean effects" audio type only makes sense to also be undefined because it indicates that the referenced track has no language. The language codes of the remaining two dispositions can also be undefined.

Change History (3)

comment:1 by Carl Eugen Hoyos, 4 years ago

Component: ffmpegundetermined
Keywords: ts removed
Priority: normalwish
Type: defectenhancement
Version: unspecifiedgit-master

Please add a (simplified!) command line including the complete, uncut console output to make this a valid ticket.

comment:2 by droid-xx, 4 years ago

ffmpeg command's output won't show anything related to the language descriptor, that's why I included info from an MPEG-TS stream analyzer. But anyway, I'm on a Windows build right now and here's the output:

ffmpeg -i sample.ts -map 0 -disposition:a:0 clean_effects -c copy sample2.ts
ffmpeg version N-100860-gc31a7d07f6-ffmpeg-windows-build-helpers Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 10.2.0 (GCC)
  configuration: --pkg-config=pkg-config --pkg-config-flags=--static --extra-version=ffmpeg-windows-build-helpers --enable-version3 --disable-debug --disable-w32threads --arch=x86 --target-os=mingw32 --cross-prefix=/home/anton/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-i686/bin/i686-w64-mingw32- --enable-libcaca --enable-gray --enable-libtesseract --enable-fontconfig --enable-gmp --enable-gnutls --enable-libass --enable-libbluray --enable-libbs2b --enable-libflite --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libvorbis --enable-libwebp --enable-libzimg --enable-libzvbi --enable-libmysofa --enable-libopenjpeg --enable-libopenh264 --enable-liblensfun --enable-libvmaf --enable-libsrt --enable-demuxer=dash --enable-libxml2 --enable-opengl --enable-libdav1d --enable-cuda-llvm --enable-libaom --enable-libvpx --enable-nvenc --enable-nvdec --extra-libs=-lharfbuzz --extra-libs=-lm --extra-libs=-lpthread --extra-cflags=-DLIBTWOLAME_STATIC --extra-cflags=-DMODPLUG_STATIC --extra-cflags=-DCACA_STATIC --enable-amf --enable-libmfx --enable-gpl --enable-frei0r --enable-filter=frei0r --enable-librubberband --enable-libvidstab --enable-libx264 --enable-libx265 --enable-avisynth --enable-libaribb24 --enable-libxvid --enable-libdavs2 --enable-libxavs --enable-avresample --extra-cflags='-mtune=generic' --extra-cflags=-O3 --enable-static --disable-shared --prefix=/home/anton/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-i686/i686-w64-mingw32
  libavutil      56. 64.100 / 56. 64.100
  libavcodec     58.119.100 / 58.119.100
  libavformat    58. 65.101 / 58. 65.101
  libavdevice    58. 11.103 / 58. 11.103
  libavfilter     7.100.100 /  7.100.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
  libpostproc    55.  8.100 / 55.  8.100
Input #0, mpegts, from 'sample.ts':
  Duration: 00:00:07.97, start: 0.220000, bitrate: 13307 kb/s
  Program 1 
    Metadata:
      service_name    : Avalpa 1
      service_provider: Avalpa
    Stream #0:0[0x810]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, progressive), 720x576 [SAR 16:15 DAR 4:3], 2000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
    Side data:
      cpb: bitrate max/min/avg: 2000000/0/0 buffer size: 1835008 vbv_delay: N/A
    Stream #0:1[0x814]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 128 kb/s
Output #0, mpegts, to 'sample2.ts':
  Metadata:
    encoder         : Lavf58.65.101
    Stream #0:0: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, progressive), 720x576 [SAR 16:15 DAR 4:3], q=2-31, 2000 kb/s, 25 fps, 25 tbr, 90k tbn, 90k tbc
    Side data:
      cpb: bitrate max/min/avg: 2000000/0/0 buffer size: 1835008 vbv_delay: N/A
    Stream #0:1: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 128 kb/s (clean effects)
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=    0 fps=0.0 q=-1.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=N/A    
frame=  200 fps=0.0 q=-1.0 Lsize=    2156kB time=00:00:15.88 bitrate=1111.6kbits/s speed=1.02e+03x    
video:1933kB audio:125kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 4.787599%

comment:3 by mkver, 4 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.