Copying a EIA-608 subtitle stream in an m4v

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

Copying a EIA-608 subtitle stream in an m4v

FFmpeg-users mailing list
I'm trying to process an m4v video with the following subtitle stream:

    Stream #0:3(eng): Subtitle: eia_608 (c608 / 0x38303663), 1920x1080, 0 kb/s (default)
    Metadata:
      creation_time   : 2014-03-29T03:43:15.000000Z
      handler_name    : Apple Closed Caption Media Handler

When I play the video in QuickTime Player, the subtitles are available for selection and display properly.

If I copy the stream, I get an error:

~~~~~

$ -> ffmpeg -i video.m4v -map 0:3 -codec copy test.m4v
...
[ipod @ 0x7f8074810600] Could not find tag for codec eia_608 in stream #0, codec not currently supported in container
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Stream mapping:
  Stream #0:3 -> #0:0 (copy)
    Last message repeated 1 times

~~~~~

(I also tried with extension mp4, behavior is the same.)

If I transcode the stream, I get a number of errors, and the resulting subtitles are garbage:

~~~~~

$ -> ffmpeg -i video.m4v -map 0:3 -codec mov_text test.m4v
...
Stream mapping:
  Stream #0:3 -> #0:0 (eia_608 (cc_dec) -> mov_text (native))
Press [q] to stop, [?] for help
[Closed caption Decoder @ 0x7fb894079800] Data Ignored since exceeding screen width
    Last message repeated 1529 times
size=       2kB time=00:07:20.53 bitrate=   0.0kbits/s speed=1.2e+04x    
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2963.333252%

~~~~~

(To test the output, I used a slightly different invocation, copying the video/audio streams, and played the file in QuickTime Player. Subtitles are gibberish.)

How can I get ffmpeg to play nicely with these subtitles?

Suggestions:
- Is there an option to override the "codec not currently supported" error? Can't ffmpeg just copy the bits and ignore the content?
- Is there another path/tool for transcoding the eia_608 subtitle stream correctly?
- All I really want at the moment is to strip a "cover art" image appearing as stream 0:4. Is there another way to accomplish that?

_______________________________________________
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: Copying a EIA-608 subtitle stream in an m4v

kumowoon1025
Hi,

> I'm trying to process an m4v video with the following subtitle stream:
>
>    Stream #0:3(eng): Subtitle: eia_608 (c608 / 0x38303663), 1920x1080, 0 kb/s (default)
>    Metadata:
>      creation_time   : 2014-03-29T03:43:15.000000Z
>      handler_name    : Apple Closed Caption Media Handler
>
> When I play the video in QuickTime Player, the subtitles are available for selection and display properly.

Keep in mind closed captions and subtitles have subtle differences, though it seems more like a subtitle in formats like these, where the captions are carried as a separate stream, they are still captions, not text or bitmap subtitles.


> If I copy the stream, I get an error:

> [ipod @ 0x7f8074810600] Could not find tag for codec eia_608 in stream #0, codec not currently supported in container
> Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument

> (I also tried with extension mp4, behavior is the same.)

Try with extension mov, and/or -strict -2.


> If I transcode the stream, I get a number of errors, and the resulting subtitles are garbage:

>  Stream #0:3 -> #0:0 (eia_608 (cc_dec) -> mov_text (native))

> [Closed caption Decoder @ 0x7fb894079800] Data Ignored since exceeding screen width
>    Last message repeated 1529 times
> size=       2kB time=00:07:20.53 bitrate=   0.0kbits/s speed=1.2e+04x    
> video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2963.333252%
>
> ~~~~~
>
> (To test the output, I used a slightly different invocation, copying the video/audio streams, and played the file in QuickTime Player. Subtitles are gibberish.)
>
> How can I get ffmpeg to play nicely with these subtitles?

I think this might be a bug? I didn’t think the captions decoder could decode in a way that direct conversion like cea-708 -> text subtitles was possible, I think it should be saying that and not do this. The gibberish is like if you used cat on a compiled executable I bet.


> Suggestions:
> - Is there an option to override the "codec not currently supported" error? Can't ffmpeg just copy the bits and ignore the content?
> - Is there another path/tool for transcoding the eia_608 subtitle stream correctly?
> - All I really want at the moment is to strip a "cover art" image appearing as stream 0:4. Is there another way to accomplish that?
- codec not currently supported _in container_ so you can dump the data or use a format that works. Usually broadcast captioning is done with scenarist .scc
- Builds with libzvbi support can extract teletext pages to side data, then you can assemble the subtitle track from that I think. Transcoding is tricky because eia_608 is not just text, or even multiple pages of text, it is comparable to the machine language used in dvd subtitles.
- Try mapping all input, negative mapping the stream you don’t want, and stream copying into QuickTime (.mov). -strict -2 might be needed.


Regards,
Ted Park

_______________________________________________
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: Copying a EIA-608 subtitle stream in an m4v

FFmpeg-users mailing list
> On Mar 26, 2020, at 8:49 PM, Ted Park <[hidden email]> wrote:
>
>> If I copy the stream, I get an error:
>
>> [ipod @ 0x7f8074810600] Could not find tag for codec eia_608 in stream #0, codec not currently supported in container
>> Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
>
>> (I also tried with extension mp4, behavior is the same.)
>
> Try with extension mov, and/or -strict -2.

Okay, using 'mov' is progress—it outputs a usable file without error.

(-strict seems to have no effect.)

To restate my goal clearly: I want to process some m4v files, removing an unwanted "cover art" image appearing as mjpeg streams.

Some problems with the "output to mov" approach:

1) I'd really like a video in the original file format when I'm done (m4v/mp4), not a mov file. I think mov files are less widely compatible, and in any case I'm going for in-place modification.

2) It strips a number of metadata tags (I counted about 13). I want to remove the mjpeg stream without perturbing the rest of the file.

3) Testing on another file (also Apple-encoded and supported), the 'mov' output chokes on another stream:

   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

It sounds like, at this point, the answer is "ffmpeg is not the tool for you", but I'm happy to hear other suggestions.

_______________________________________________
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: Copying a EIA-608 subtitle stream in an m4v

Carl Eugen Hoyos-2
Am Fr., 27. März 2020 um 17:58 Uhr schrieb Dan Smith via ffmpeg-user
<[hidden email]>:

> To restate my goal clearly: I want to process some m4v files,
> removing an unwanted "cover art" image appearing as mjpeg
> streams.

Just to clarify in case it is necessary:
FFmpeg never "removes" anything from a file, when you
so stream copy with ffmpeg, a new file is created with
new (and most likely) different features than the input
file (except for the media content).

MP4Box may or may not be able to do what you want.

For future questions:
Please never provide an excerpt of the console output,
always post the command line you tested together with
the complete, uncut console output.

And finally:
The fact that movtext is supported in mov but not in the
ipad output format sounds like a bug.

Carl Eugen
_______________________________________________
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: Copying a EIA-608 subtitle stream in an m4v

kumowoon1025
In reply to this post by FFmpeg-users mailing list
Hi,

> Okay, using 'mov' is progress—it outputs a usable file without error.
>
> (-strict seems to have no effect.)
>
> To restate my goal clearly: I want to process some m4v files, removing an unwanted "cover art" image appearing as mjpeg streams.
>
> Some problems with the "output to mov" approach:
>
> 1) I'd really like a video in the original file format when I'm done (m4v/mp4), not a mov file. I think mov files are less widely compatible, and in any case I'm going for in-place modification.

You are correct more or less, QuickTime file format or ISO base media file format is what the long name for “mov” files would be, and it serves as a template of sorts that many other formats (especially IEC family) are based on, including MP4.

m4v is just an alternate extension for mp4 files that Apple used to use on the content they distributed indicating certain profile requirements or DRM presence.

Now, the original mov files were a big superset including mp4 files, and also pretty much any A/V content, even stuff like interactive games (when QuickTime had that brushed metal look and had a 4 figure price tag for server+client license). But this is far from what a typical QuickTime file contains nowadays, to the point where if the media uses a supported codec, and you did not use any quicktime features to edit the file, more often than not you can replace the extension with mp4 or m4v, and it will be recognized by the application that consumes it.

> 2) It strips a number of metadata tags (I counted about 13). I want to remove the mjpeg stream without perturbing the rest of the file.

This can be done, add -map_metadata 0 for the global file-level metadata and -map_metadata:s: 0:s: for stream-level metadata. As I’ll explain, you can’t remove the mjpeg stream, but you can copy everything else but the mjpeg stream. Add -map 0 to copy everything and then add -map -0:# (where # is the stream index of the cover image) to not copy it.

> 3) Testing on another file (also Apple-encoded and supported), the 'mov' output chokes on another stream:
>
>   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

This I am curious about, tx3g literally indicates mp4:17 text streams, with decoder name “mov_text”. Do you have a sample you can provide?


> It sounds like, at this point, the answer is "ffmpeg is not the tool for you", but I'm happy to hear other suggestions.

I mean, it does seem like there are easier alternatives if this is all you are trying to do. Ffmpeg covers a lot of ground. But one thing that ffmpeg doesn’t do (I believe) is “in-place modification.” Personally I don’t think you should do this anyways on binary files you don’t want to risk breaking, but mov/mp4/m4v has a pretty solid definition of its structure that tools exist that work on the files in-place.

If by other suggestions you meant alternative tools, gpac, l-smash, mp4box are some tools that can work on ISO-family format files, if not in-place, piece by piece. If you have a Mac and are okay with a GUI solution, Subler is a very popular tool for apple-device-compatible-file editing.


Regards,
Ted Park

_______________________________________________
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: Copying a EIA-608 subtitle stream in an m4v

Carl Eugen Hoyos-2
In reply to this post by FFmpeg-users mailing list
Am Fr., 27. März 2020 um 17:58 Uhr schrieb Dan Smith via ffmpeg-user
<[hidden email]>:

> 1) I'd really like a video in the original file format when I'm done (m4v/mp4), not a mov file.

ipad files are mostly mov files, mp4 files are a little different.
("m4v" is something entirely different in FFmpeg)

> I think mov files are less widely compatible

My personal experience is that mov is more widely compatible than mp4.

> and in any case I'm going for in-place modification.

I have tried to answer this: FFmpeg cannot do this.

Carl Eugen
_______________________________________________
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: Copying a EIA-608 subtitle stream in an m4v

FFmpeg-users mailing list
In reply to this post by Carl Eugen Hoyos-2
> On Mar 27, 2020, at 11:23 AM, Carl Eugen Hoyos <[hidden email]> wrote:
>
> Am Fr., 27. März 2020 um 17:58 Uhr schrieb Dan Smith via ffmpeg-user
> <[hidden email]>:
>
>> To restate my goal clearly: I want to process some m4v files,
>> removing an unwanted "cover art" image appearing as mjpeg
>> streams.
>
> Just to clarify in case it is necessary:
> FFmpeg never "removes" anything from a file, when you
> so stream copy with ffmpeg, a new file is created with
> new (and most likely) different features than the input
> file (except for the media content).

Sure. I don't necessarily require *literal* removal of some data from a file. But I'm looking for a process that will *logically* amount to removal of some data. This process could look like:

mv filename.m4v filename-bak.m4v
some-command -from filename-bak.m4v -to filename.m4v

The process is successful if the result of the process looks like what you would expect from literal removal.

_______________________________________________
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: Copying a EIA-608 subtitle stream in an m4v

FFmpeg-users mailing list
In reply to this post by kumowoon1025
> On Mar 27, 2020, at 11:38 AM, Ted Park <[hidden email]> wrote:
>
>> 2) It strips a number of metadata tags (I counted about 13). I want to remove the mjpeg stream without perturbing the rest of the file.
>
> This can be done, add -map_metadata 0 for the global file-level metadata and -map_metadata:s: 0:s: for stream-level metadata. As I’ll explain, you can’t remove the mjpeg stream, but you can copy everything else but the mjpeg stream. Add -map 0 to copy everything and then add -map -0:# (where # is the stream index of the cover image) to not copy it.

-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.

Here's the command line I used, FWIW:

ffmpeg -strict experimental -i video.m4v -map_metadata 0 -map 0 -map -0:4 -codec copy test.mov

>> 3) Testing on another file (also Apple-encoded and supported), the 'mov' output chokes on another stream:
>>
>>  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
>
> This I am curious about, tx3g literally indicates mp4:17 text streams, with decoder name “mov_text”. Do you have a sample you can provide?

It's a copyrighted movie, but here's the relevant command line interaction (the problematic stream is #0:4; if I exclude it, the command succeeds):

$ -> ffmpeg -i video.m4v -map 0 -codec copy test.mov
ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
  built with Apple clang version 11.0.0 (clang-1100.0.33.16)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.2.2 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags='-I/Library/Java/JavaVirtualMachines/adoptopenjdk-13.0.1.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/adoptopenjdk-13.0.1.jdk/Contents/Home/include/darwin -fno-stack-check' --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f8625000800] stream 0, timescale not set
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.m4v':
  Metadata:
    major_brand     : M4V
    minor_version   : 0
    compatible_brands: M4V mp42isom

...

    Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 126 kb/s (default)
    Metadata:
      creation_time   : 2016-07-15T19:12:05.000000Z
      handler_name    : Core Media Audio
    Stream #0:1(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709, progressive), 640x480 [SAR 4:3 DAR 16:9], 1432 kb/s, 23.98 fps, 23.98 tbr, 2997 tbn, 5994 tbc (default)
    Metadata:
      creation_time   : 2016-07-15T19:12:05.000000Z
      handler_name    : Core Media Video
    Stream #0:2(eng): Subtitle: mov_text (tx3g / 0x67337874), 853x72, 0 kb/s (default)
    Metadata:
      rotate          : 0
      creation_time   : 2016-07-15T19:12:05.000000Z
      handler_name    : Core Media Subtitle
    Stream #0:3(eng): Subtitle: eia_608 (c608 / 0x38303663), 853x480, 0 kb/s (default)
    Metadata:
      creation_time   : 2016-07-15T19:12:05.000000Z
      handler_name    : Core Media Closed Caption
    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
    Stream #0:6(eng): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 5.1(side), fltp, 384 kb/s
    Metadata:
      creation_time   : 2016-07-15T19:12:05.000000Z
      handler_name    : Core Media Audio
    Side data:
      audio service type: main
    Stream #0:7(spa): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s
    Metadata:
      creation_time   : 2016-07-15T19:12:05.000000Z
      handler_name    : Core Media Audio
    Stream #0:8: Video: mjpeg (Baseline), yuvj444p(pc, bt470bg/unknown/unknown), 720x1080 [SAR 1:1 DAR 2:3], 90k tbr, 90k tbn, 90k tbc (attached pic)
[mov @ 0x7f862480ba00] Tag tx3g incompatible with output codec id '100359' ([0][0][0][0])
Could not write header for output file #0 (incorrect codec parameters ?): Invalid data found when processing input
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)
  Stream #0:5 -> #0:5 (copy)
  Stream #0:6 -> #0:6 (copy)
  Stream #0:7 -> #0:7 (copy)
  Stream #0:8 -> #0:8 (copy)
    Last message repeated 1 times

> If by other suggestions you meant alternative tools, gpac, l-smash, mp4box are some tools that can work on ISO-family format files, if not in-place, piece by piece. If you have a Mac and are okay with a GUI solution, Subler is a very popular tool for apple-device-compatible-file editing.

I'll investigate some of these, thanks.

ffmpeg does seem pretty ubiquitous as a Swiss army knife kind of tool, so I'm glad to have gotten more familiar with it, but something else may be better for this particular problem.

_______________________________________________
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: Copying a EIA-608 subtitle stream in an m4v

kumowoon1025
In reply to this post by FFmpeg-users mailing list
Hi,

> Sure. I don't necessarily require *literal* removal of some data from a file. But I'm looking for a process that will *logically* amount to removal of some data. This process could look like:
>
> mv filename.m4v filename-bak.m4v
> some-command -from filename-bak.m4v -to filename.m4v
>
> The process is successful if the result of the process looks like what you would expect from literal removal.
Yes, I didn’t think so either, and I don’t think you’ve been misconstrued in that way. In the first place you very rarely gouge out a chunk of bytes from a file on-disk, it is going to be copied to and from memory, kind of like the process you illustrated.

The main point is that ffmpeg will in almost all cases disassemble the multiplexed file apart into its constituent elementary streams and pieces of metadata, then reassemble them to produce its output. So apart from the default stream selection and metadata mapping behavior, which is usually a video stream and audio stream, you will need to specify everything you want.

> -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?? ._.

> 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?

Regards,
Ted Park

_______________________________________________
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: Copying a EIA-608 subtitle stream in an m4v

FFmpeg-users mailing list
> On Mar 27, 2020, at 1:47 PM, Ted Park <[hidden email]> 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.

_______________________________________________
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".