Jump to content

Forced subtitles (mp4)


Recommended Posts

dprovencher
Posted

I wrote an app using mediainfo / mp4box to specifically edit track language, default tag and forced tag according to my needs because I share my stuff with family and they are not used to select subs everytime a video starts and checking if it's the right one, etc.  Almost all of my videos contain at least 2 audio tracks and multiple embedded subs, normal and forced.  I live in Canada (French) and I have many files with fr-CA audio and fr-CA forced subs.  I also have "fra" audio in other files along with fra forced subs.  Almost all files also have eng audio with normal eng subs and also eng forced subs.

 

Example 1 : Audio fra,eng Subtitle fra(forced),eng(forced),eng

Example 2 : Audio fr-CA,en-GB Subtitle fr-CA(forced),en-GB

 

The problem I have, now that my files are correctly edited, is emby does not detect the Forced flag in mp4 files, or at least does not update the info regarding the file.  I did a library scan and replace metadata and nothing changed.  I use .nfos for everything if that's relevant, and those don't have the default / forced flags in them, only the mp4 themselves, but I hope emby use mediainfo.

 

Thank you,

Posted

Hello dprovencher,

** This is an auto reply **

Please wait for someone from staff support or our members to reply to you.

It's recommended to provide more info, as it explain in this thread:


Thank you.

Emby Team

Happy2Play
Posted
2 minutes ago, dprovencher said:

I use .nfos for everything if that's relevant, and those don't have the default / forced flags in them

No video info is ever read from nfo files and is always gotten via ffprobe.

What is shown in media info for a specific example but flags and track names should be totally different.

dprovencher
Posted

Here is one video as an example :

 

image.thumb.png.a98a2162a3a3818f1a085fc57bc0a3b8.png

 

What mediainfo shows :

 

Audio #1
ID                                       : 3
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 1 h 41 min
Bit rate mode                            : Constant
Bit rate                                 : 125 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 91.4 MiB (2%)
Title                                    : BAMTech audio / English
Language                                 : English
Default                                  : No
Alternate group                          : 2
Tagged date                              : 2024-08-30 14:06:18 UTC

Audio #2
ID                                       : 4
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 1 h 41 min
Bit rate mode                            : Constant
Bit rate                                 : 125 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 91.4 MiB (2%)
Title                                    : BAMTech audio / Français (Canadien)
Language                                 : French (CA)
Default                                  : No
Alternate group                          : 3
Tagged date                              : 2024-08-30 14:06:18 UTC

Text #1
ID                                       : 5
Format                                   : Timed Text
Muxing mode                              : sbtl
Codec ID                                 : tx3g
Duration                                 : 1 h 41 min
Bit rate mode                            : Variable
Bit rate                                 : 56 b/s
Frame rate                               : 0.487 FPS
Stream size                              : 41.2 KiB (0%)
Title                                    : English [CC]
Language                                 : English
Default                                  : No
Forced                                   : No
Alternate group                          : 4
Tagged date                              : 2024-08-30 14:06:18 UTC
Count of events                          : 1478

Text #2
ID                                       : 6
Format                                   : Timed Text
Muxing mode                              : sbtl
Codec ID                                 : tx3g
Duration                                 : 27 min 24 s
Bit rate mode                            : Variable
Bit rate                                 : 1 b/s
Frame rate                               : 0.010 FPS
Stream size                              : 253 Bytes (0%)
Title                                    : fr-CA--forced--
Language                                 : French (CA)
Default                                  : No
Forced                                   : Yes
Alternate group                          : 5
Tagged date                              : 2024-08-30 14:06:18 UTC
Count of events                          : 8

dprovencher
Posted

Same file, from ffprobe :

 

Stream #0:1[0x3](eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 125 kb/s
      Metadata:
        handler_name    : BAMTech audio
        vendor_id       : [0][0][0][0]
  Stream #0:2[0x4](fra): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 125 kb/s
      Metadata:
        handler_name    : BAMTech audio
        vendor_id       : [0][0][0][0]
  Stream #0:3[0x5](eng): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
  Stream #0:4[0x6](fra): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler

 

I'm not used to ffprobe, is there some kind of way to get the real language (fr-CA) and the default / forced tags?

Happy2Play
Posted

Dev will have to comment as Emby uses ffmpeg/ffprobe for everything.

Not familiar embedded info in mp4 as it is slightly different then mkv and the specific language code requirements.

Posted

HI, the first step is that ffmpeg/ffprobe needs to support this data for mp4 files. Once it does, then Emby will be able to utilize it.

dprovencher
Posted

Thank you Luke for your input!

 

Would using mediainfo be something you could look at?  It is widely used everywhere (MPC, vlc, most media managers like tinyMM, etc.) it outputs json or xml and is very easy to work with.

 

Meanwhile, can you tell me with mkv are the languages like fr-CA supported and multiple forced subs?  I could switch my files if mkv works for what I want, as long as emby does not rebuild my whole library because I switched extensions.

 

Thank you!

dprovencher
Posted

I played around with ffprobe and found what I'm looking for, at least for the "forced" part :

 

-show_streams -show_data

 

For the 2 subs only :

 

 

[STREAM]
index=3
codec_name=mov_text
codec_long_name=MOV text
profile=unknown
codec_type=subtitle
codec_tag_string=tx3g
codec_tag=0x67337874
width=N/A
height=N/A
id=0x5
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/1000000
start_pts=0
start_time=0.000000
duration_ts=6073120000
duration=6073.120000
bit_rate=55
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=2957
nb_read_frames=N/A
nb_read_packets=N/A
extradata=
00000000: 0000 0000 01ff 0000 00ff 0000 0000 0000  ................
00000010: 0000 0000 0000 0001 0010 ffff ffff 0000  ................
00000020: 0012 6674 6162 0001 0001 0541 7269 616c  ..ftab.....Arial
00000030: 0000 0014 6274 7274 0000 0000 0000 0037  ....btrt.......7
00000040: 0000 0037                                ...7

extradata_size=68
DISPOSITION:default=0
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
DISPOSITION:non_diegetic=0
DISPOSITION:captions=0
DISPOSITION:descriptions=0
DISPOSITION:metadata=0
DISPOSITION:dependent=0
DISPOSITION:still_image=0
TAG:language=eng
TAG:handler_name=SubtitleHandler
[/STREAM]
[STREAM]
index=4
codec_name=mov_text
codec_long_name=MOV text
profile=unknown
codec_type=subtitle
codec_tag_string=tx3g
codec_tag=0x67337874
width=N/A
height=N/A
id=0x6
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/1000000
start_pts=0
start_time=0.000000
duration_ts=1644440001
duration=1644.440001
bit_rate=1
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=17
nb_read_frames=N/A
nb_read_packets=N/A
extradata=
00000000: c000 0000 01ff 0000 00ff 0000 0000 0000  ................
00000010: 0000 0000 0000 0001 0010 ffff ffff 0000  ................
00000020: 0012 6674 6162 0001 0001 0541 7269 616c  ..ftab.....Arial
00000030: 0000 0014 6274 7274 0000 0000 0000 0001  ....btrt........
00000040: 0000 0001                                ....

extradata_size=68
DISPOSITION:default=0
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
DISPOSITION:non_diegetic=0
DISPOSITION:captions=0
DISPOSITION:descriptions=0
DISPOSITION:metadata=0
DISPOSITION:dependent=0
DISPOSITION:still_image=0
TAG:language=fra
TAG:handler_name=SubtitleHandler
[/STREAM]

 

You can see the diffrence in extradata, the forced subs begins with "c0" and the normal is "00".  I knew what I was looking for as I add this flag with mp4box (txtflags=0xC0000000)

 

I can't find anything regarding the language, but mediainfo has all of this.

 

Thank you!

dprovencher
Posted

Well I've decided to test things out with mkv and even though ffprobe does not support normal languages like fr-CA emby displays the name of the track I put in and the forced flag is displayed too so I can work around with that at least.  Maybe you could look at how Disney+, Netflix, Prime work and try to make something that works with modern languages and multi-language files.  I'm sure I'm not the only one.

 

Thank you,

Posted (edited)

I know on the Roku that embedded subtitles aren't supported inside MP4. For MP4 to have selectable/working subtitles these must be external SRT. Using MKV you will have much more compatibility with clients and the subtitles will be selectable/work and will be able to be embedded.

The only real advantage I see to MP4 is some clients require MP4 to trigger DolbyVision.

Edited by speechles
  • Like 1
Posted
22 minutes ago, speechles said:

I know on the Roku that embedded subtitles aren't supported inside MP4. For MP4 to have selectable/working subtitles these must be external SRT. Using MKV you will have much more compatibility with clients and the subtitles will be selectable/work and will be able to be embedded.

The only real advantage I see to MP4 is some clients require MP4 to trigger DolbyVision.

They are still supported when playing with Emby though. It will either use on the fly extraction or trigger transcoding, depending on server settings.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...