[FFmpeg-user] Copying a EIA-608 subtitle stream in an m4v

Dan Smith dansmithx at icloud.com
Fri Mar 27 23:19:23 EET 2020


> On Mar 27, 2020, at 1:47 PM, Ted Park <kumowoon1025 at gmail.com> wrote:
> 
>> -map_metadata 0 doesn't help—the metadata is still stripped (some well-known tags are preserved, but only a few). It appears ffmpeg is not willing to put unrecognized tags in the output when copying from m4v to mov.
> 
> Several people have reported the creation_time not being copied, but as I can only guess, I think the metadata you are referring to are extensive comments or synopsis type strings? If it reads like the jacket cover of a book, or some library catalog record, they were probably in their own “box” at the same level as other streams in some sense, instead of short strings in the headers for each track which is the default. I’d suggest trying -movflags +use_metadata_tags. The uncut console output would really be helpful in the absence of a sample for its copyright status. Why leave out which tags were omitted?? ._.

"-movflags +use_metadata_tags" seems to do the trick. Thanks!

I excluded the details previously because it's just a lot of noise for the other issues I was discussing. But, since you're interested:

Original file:

  Metadata:
    major_brand     : M4V 
    minor_version   : 0
    compatible_brands: M4V mp42isom
    creation_time   : 2014-03-29T03:43:15.000000Z
    title           : Pilot, Pt. 1
    artist          : LOST
    album_artist    : LOST
    album           : Lost, Season 1
    genre           : Drama
    track           : 1
    disc            : 1/1
    compilation     : 0
    gapless_playback: 0
    date            : 2004-09-22T07:00:00Z
    copyright       : © ABC Studios
    description     : Out of the blackness, the first thing Jack (Matthew Fox) senses is pain. Then burning sun. A bamboo forest. Smoke. Screams. 
    hd_video        : 2
    show            : Lost
    episode_id      : 100A
    season_number   : 1
    episode_sort    : 1
    media_type      : 10
    purchase_date   : 2009-06-11 01:18:58
    iTunEXTC        : us-tv|TV-14|500|
    synopsis        : Out of the blackness, the first thing Jack (Matthew Fox) senses is pain. Then burning sun. A bamboo forest. Smoke. Screams. With a rush comes the horrible awareness that the plane he was on tore apart in mid-air and crashed on a Pacific island. From there
    iTunMOVI        : <?xml version="1.0" encoding="UTF-8"?>
                    : <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
                    : <plist version="1.0">
                    : <dict>
                    : 	<key>asset-info</key>
                    : 	<dict>
                    : 		<key>closed-captioned</key>
                    : 		<true/>
                    : 		<key>file-size</key>
                    : 		<integer>1457698388</integer>
                    : 		<key>flavor</key>
                    : 		<string>7:720p</string>
                    : 		<key>high-definition</key>
                    : 		<true/>
                    : 		<key>screen-format</key>
                    : 		<string>widescreen</string>
                    : 		<key>soundtrack</key>
                    : 		<string>DD,DS</string>
                    : 	</dict>
                    : </dict>
                    : </plist>
                    : 

Result of 'ffmpeg -i video.m4v -map 0 -map -0:3 -codec copy test.m4v' (turns out this discards some tags, too, but not as many):

  Metadata:
    major_brand     : M4V 
    minor_version   : 512
    compatible_brands: isomiso2avc1
    title           : Pilot, Pt. 1
    artist          : LOST
    album_artist    : LOST
    album           : Lost, Season 1
    date            : 2004-09-22T07:00:00Z
    encoder         : Lavf58.29.100
    genre           : Drama
    copyright       : © ABC Studios
    description     : Out of the blackness, the first thing Jack (Matthew Fox) senses is pain. Then burning sun. A bamboo forest. Smoke. Screams. 
    synopsis        : Out of the blackness, the first thing Jack (Matthew Fox) senses is pain. Then burning sun. A bamboo forest. Smoke. Screams. With a rush comes the horrible awareness that the plane he was on tore apart in mid-air and crashed on a Pacific island. From there
    show            : Lost
    episode_id      : 100A
    episode_sort    : 1
    season_number   : 1
    media_type      : 10
    hd_video        : 2
    gapless_playback: 0
    compilation     : 0
    track           : 1
    disc            : 1/1

Result of 'ffmpeg -i video.m4v -map 0 -map -0:3 -codec copy test.mov':

  Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    artist          : LOST
    title           : Pilot, Pt. 1
    album           : Lost, Season 1
    date            : 2004-09-22T07:00:00Z
    encoder         : Lavf58.29.100
    genre           : Drama
    copyright       : © ABC Studios

Result of 'ffmpeg -i video.m4v -movflags +use_metadata_tags -map 0 -map -0:3 -codec copy test.m4v' or 'ffmpeg -i video.m4v -movflags +use_metadata_tags -map 0 -map -0:3 -codec copy test.mov' (metadata is the same either way):

  Metadata:
    minor_version   : 0
    major_brand     : M4V 
    compatible_brands: M4V mp42isom
    iTunMOVI        : <?xml version="1.0" encoding="UTF-8"?>
                    : <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
                    : <plist version="1.0">
                    : <dict>
                    : 	<key>asset-info</key>
                    : 	<dict>
                    : 		<key>closed-captioned</key>
                    : 		<true/>
                    : 		<key>file-size</key>
                    : 		<integer>1457698388</integer>
                    : 		<key>flavor</key>
                    : 		<string>7:720p</string>
                    : 		<key>high-definition</key>
                    : 		<true/>
                    : 		<key>screen-format</key>
                    : 		<string>widescreen</string>
                    : 		<key>soundtrack</key>
                    : 		<string>DD,DS</string>
                    : 	</dict>
                    : </dict>
                    : </plist>
                    : 
    title           : Pilot, Pt. 1
    artist          : LOST
    album_artist    : LOST
    album           : Lost, Season 1
    genre           : Drama
    track           : 1
    disc            : 1/1
    compilation     : 0
    gapless_playback: 0
    date            : 2004-09-22T07:00:00Z
    copyright       : © ABC Studios
    description     : Out of the blackness, the first thing Jack (Matthew Fox) senses is pain. Then burning sun. A bamboo forest. Smoke. Screams. 
    hd_video        : 2
    show            : Lost
    episode_id      : 100A
    season_number   : 1
    episode_sort    : 1
    media_type      : 10
    purchase_date   : 2009-06-11 01:18:58
    iTunEXTC        : us-tv|TV-14|500|
    synopsis        : Out of the blackness, the first thing Jack (Matthew Fox) senses is pain. Then burning sun. A bamboo forest. Smoke. Screams. With a rush comes the horrible awareness that the plane he was on tore apart in mid-air and crashed on a Pacific island. From there
    encoder         : Lavf58.29.100

>> Stream #0:4(eng): Data: bin_data (tx3g / 0x67337874), 0 kb/s
>>   Metadata:
>>     creation_time   : 2016-07-15T19:12:05.000000Z
>>     handler_name    : Core Media Text
>>   Stream #0:5(und): Video: mjpeg (Baseline) (jpeg / 0x6765706A), yuvj444p(pc, bt470bg/unknown/unknown, progressive), 640x360 [SAR 72:72 DAR 16:9], 8 kb/s, SAR 65536:62805 DAR 1048576:565245, 0.0042 fps, 1 tbr, 1k tbn, 1k tbc (attached pic) (timed thumbnails)
>>   Metadata:
>>     rotate          : 0
>>     creation_time   : 2016-07-15T19:12:05.000000Z
>>     handler_name    : Core Media Video
>>   Side data:
>>     displaymatrix: rotation of -0.00 degrees
> 
> Again, only a guess, but I think this might be chapter/scene titles track from the timed thumbnails disposition on the image track? I don’t think I’ve seen it like that, it reminds me of mkv’s chapters, curious about it now, I don’t seem to remember iTunes being this way ~2016. Does the movie have working chapter markers? What application saved a file in this format?

It's an iTunes movie, with minimal processing to remove encryption. Yes, it has working chapter markers and subtitles.

There are two options for subtitles in QuickTime Player: English (US) and English (CC). Those correspond to streams 0:2 and 0:3. The chapter titles/markers are in the standard format (reported by ffmpeg as "Chapter #0:0: start 0.000000, end 194.000000", etc.) The chapters have thumbnails in the UI, which I'm guessing come from stream 0:5.

So I'm not really sure what stream 0:4 is for.

Anyway, my issue is, whatever this stream is for, I don't care, but I want to keep it intact. And it sounds like ffmpeg isn't able to do that.



More information about the ffmpeg-user mailing list