Retain audio track titles that are displayed in VLC

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Retain audio track titles that are displayed in VLC

Janis Hamme
Hi all,

i'm trying to cut some TV recordings with FFmpeg and would like to keep
as much metadata as possible.

Cutting works well for the most part but the audio track titles that are
displayed in VLC for the original transport stream are always lost in
the process - even if I'm just remuxing the streams into a new TS
container. The only software I know that manages to retain the titles is
the commercial Windows tool TS-Doctor.

I've uploaded a short sample file [1] and a screenshot of the track
title display in VLC [2]. After running

ffmpeg -i test.ts -map 0 -c copy test-ffmpeg.ts

the title that was displayed for audio track 2 (visual impaired) is
gone. VLC only shows the language for each track in the output file.
I've attached the output of ffmpeg below.

Does anybody know if these audio track titles can be retained somehow?

Regards
Janis

[1] http://www.hamme.info/files/tests.ts
[2] http://www.hamme.info/files/vlc-audio-tracks.png

ffmpeg version 4.1.3 from Debian Buster:

Input #0, mpegts, from 'test.ts':
  Duration: 00:01:00.22, start: 36865.445022, bitrate: 7586 kb/s
  Program 55101
    Stream #0:0[0x201]: Video: h264 (High) ([27][0][0][0] / 0x001B),
yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], 50 fps, 50 tbr, 90k
tbn, 100 tbc
    Stream #0:1[0x202](deu): Audio: mp2 ([3][0][0][0] / 0x0003), 48000
Hz, stereo, fltp, 192 kb/s
    Stream #0:2[0x203](deu): Audio: mp2 ([3][0][0][0] / 0x0003), 48000
Hz, stereo, fltp, 192 kb/s (visual impaired) (descriptions)
    Stream #0:3[0x204](deu): Audio: ac3 ([6][0][0][0] / 0x0006), 48000
Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:4[0x5f1](deu): Subtitle: dvb_subtitle ([6][0][0][0] /
0x0006) (hearing impaired)
Output #0, mpegts, to 'test-ffmpeg.ts':
  Metadata:
    encoder         : Lavf58.20.100
    Stream #0:0: Video: h264 (High) ([27][0][0][0] / 0x001B),
yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 50 fps, 50
tbr, 90k tbn, 90k tbc
    Stream #0:1(deu): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz,
stereo, fltp, 192 kb/s
    Stream #0:2(deu): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz,
stereo, fltp, 192 kb/s (visual impaired) (descriptions)
    Stream #0:3(deu): Audio: ac3 ([6][0][0][0] / 0x0006), 48000 Hz,
5.1(side), fltp, 448 kb/s
    Stream #0:4(deu): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
(hearing impaired)
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
  Stream #0:2 -> #0:2 (copy)
  Stream #0:3 -> #0:3 (copy)
  Stream #0:4 -> #0:4 (copy)
Press [q] to stop, [?] for help
frame= 3012 fps=0.0 q=-1.0 Lsize=   52431kB time=00:01:00.26
bitrate=7127.7kbits/s speed= 576x   
video:42024kB audio:6118kB subtitle:6kB other streams:0kB global
headers:0kB muxing overhead: 8.896022%




_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Retain audio track titles that are displayed in VLC

Janis Hamme
Am 24.07.19 um 23:03 schrieb Janis Hamme:
> [1] http://www.hamme.info/files/tests.ts

Ups, got the link wrong ... corrected link to test file:

[1] http://www.hamme.info/files/test.ts

Regards
Janis

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Retain audio track titles that are displayed in VLC

kumowoon1025
In reply to this post by Janis Hamme
> ffmpeg -i test.ts -map 0 -c copy test-ffmpeg.ts
>
> the title that was displayed for audio track 2 (visual impaired) is
> gone. VLC only shows the language for each track in the output file.
> I've attached the output of ffmpeg below.

This metadata isn’t actually a “title” per se, but what is called a disposition. What I mean is that It’s not text metadata, but a flag that marks the track as appropriate for “visually impaired” audiences.

I would have thought such metadata (and track disposition) would automatically get mapped over, but if it is not happening, you can set it using the -disposition option.

It’s a per-stream option, so for example, if you wanted to mark the second audio track with the visual_impaired disposition, you would add -disposition:a:1 visual_impaired to your command. (Streams are indexed starting from 0, so 0 for the first stream, 1 for the second, and so on.)

This info is in the man page if you have it compiled, and there are more dispositions listed there, so you might want to take a look.

Regards,
Ted
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Retain audio track titles that are displayed in VLC

Moritz Barsnick
In reply to this post by Janis Hamme
On Wed, Jul 24, 2019 at 23:03:12 +0200, Janis Hamme wrote:
> I've uploaded a short sample file [1] and a screenshot of the track
> title display in VLC [2]. After running
>
> ffmpeg -i test.ts -map 0 -c copy test-ffmpeg.ts
>
> the title that was displayed for audio track 2 (visual impaired) is
> gone. VLC only shows the language for each track in the output file.
> I've attached the output of ffmpeg below.

When I do this - with ffmpeg from git - the dispositions are retained,
and smplayer manages to display them from the resulting file, similarly
to what you expect from VLC. (Too lazy to install VLC right now.)

Peculiar. Have you tried a more recent ffmpeg (not that I expect it to
have relevant changes in this matter)?

Moritz
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Retain audio track titles that are displayed in VLC

Janis Hamme
Hi Moritz,

I don't think the problem is caused by missing track disposition.
I tried smplayer and is indeed showing the track disposition on the
output file.
(ffmpeg -i shows it too)

VLC seems to read some other flags from the TS container and maps these
to a track description:
https://github.com/videolan/vlc/search?q=impaired&unscoped_q=impaired

Probably ffmpeg uses another format for the disposition that VLC does
not understand.
> Have you tried a more recent ffmpeg (not that I expect it to
> have relevant changes in this matter)?
It's only behind by a minor version (4.1.3 vs 4.1.4). Debian Buster is
still fresh ;-)

Regards
Janis

Am 25.07.19 um 10:25 schrieb Moritz Barsnick:

> On Wed, Jul 24, 2019 at 23:03:12 +0200, Janis Hamme wrote:
>> I've uploaded a short sample file [1] and a screenshot of the track
>> title display in VLC [2]. After running
>>
>> ffmpeg -i test.ts -map 0 -c copy test-ffmpeg.ts
>>
>> the title that was displayed for audio track 2 (visual impaired) is
>> gone. VLC only shows the language for each track in the output file.
>> I've attached the output of ffmpeg below.
> When I do this - with ffmpeg from git - the dispositions are retained,
> and smplayer manages to display them from the resulting file, similarly
> to what you expect from VLC. (Too lazy to install VLC right now.)
>
> Peculiar. Have you tried a more recent ffmpeg (not that I expect it to
> have relevant changes in this matter)?
>
> Moritz
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".


_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Retain audio track titles that are displayed in VLC

Moritz Barsnick
On Thu, Jul 25, 2019 at 21:06:03 +0200, Janis Hamme wrote:
> VLC seems to read some other flags from the TS container and maps these
> to a track description:
> https://github.com/videolan/vlc/search?q=impaired&unscoped_q=impaired

Ah, okay! I didn't realize they would do it differently.

VLC appears to use the supplementary_audio_descriptor, where the
editorial_classification determines the description you see in VLC.

In ffmpeg's libavformat/mpegts.c (demuxer), both the ISO 639 language
descriptor and the supplementary audio descriptor are evaluated to
obtain the disposition information. In the ffmpeg muxer, only the ISO
639 language descriptor is written though. VLC on the other hand only
checks the supplementary audio descriptor. Nice mismatch. ;-) That's
where you observe your loss of information.

ffmpeg's TS muxer is known to have quite a lot of limitations, but this
one clashes with VLC.

My guess is that mpegtsenc.c's mpegts_write_pmt() needs to gain a
section for writing the supplementary audio descriptor (0x06) with some
payload like this:

            *q = (st->disposition & AV_DISPOSITION_DEPENDENT) ? 0 : 0x80; /* mix type */
            if (st->disposition & AV_DISPOSITION_HEARING_IMPAIRED)
                *q |= 0x2 << 2;
            else if (st->disposition & AV_DISPOSITION_VISUAL_IMPAIRED)
                if (st->disposition & AV_DISPOSITION_DESCRIPTIONS)
                    *q |= 0x1 << 2;
                else
                    *q |= 0x3 << 2;
            q++;

I don't have enough insight yet to complete this code though. :P

> Probably ffmpeg uses another format for the disposition that VLC does
> not understand.
> > Have you tried a more recent ffmpeg (not that I expect it to
> > have relevant changes in this matter)?
> It's only behind by a minor version (4.1.3 vs 4.1.4). Debian Buster is
> still fresh ;-)

No, I actually mean ffmpeg's development on the master branch. That's
where feature enhancements happen (and they are not backported to the
previous release series):

https://github.com/FFmpeg/FFmpeg/compare/n4.1.3...master

Cheers,
Moritz
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".