Copy all metadata fields?

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

Copy all metadata fields?

Peter B.
Hi everyone!

Is it possible to ask/force FFmpeg to keep as many metadata fields as
technically possible when transcoding or rewrapping?

I understand that not all (container-)formats support the same metadata
fields, but I've noticed for example that when rewrapping, not all
metadata fields that were populated in the input are then present in the
output - even if the format is identical.


Here is an example of rewrapping MOV to MOV where I've noticed the
following data missing in the output (commandline and output see below):

   * color information (smpte170m/bt470bg/bt709)
   * creation_time (*)


I'm grateful for any hints or suggestions!
Thank you in advance,
Peter

(*) Copying "creation_time" may be controversial, but it would be
amazing to be able to preserve this information in the output (e.g. map
it to a different field?).




Files were created with the following command:
// ------------------------
$ ffmpeg -i in.mov -c copy -map 0 out.mov
// ------------------------


Then metadata checked as follows:
// ------------------------
$ ffmpeg -i in.mov -i out.mov -hide_banner
// ------------------------



Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'in.mov':
   Metadata:
     major_brand     : qt
     minor_version   : 0
     compatible_brands: qt
     creation_time   : 2012-01-18T12:50:53.000000Z
   Duration: 00:03:54.80, start: 0.000000, bitrate: 30453 kb/s
     Stream #0:0(und): Video: dvvideo (dvcp / 0x70637664),
yuv420p(smpte170m/bt470bg/bt709, bottom coded first (swapped)), 720x576
[SAR 16:15 DAR 4:3], 28800 kb/s, SAR 59:54 DAR 295:216, 25 fps, 25 tbr,
25k tbn, 25 tbc (default)
     Metadata:
       creation_time   : 2012-01-18T12:50:53.000000Z
       handler_name    : Core Media Video
       encoder         : DV - PAL
       timecode        : 00:37:50:04
     Stream #0:1(und): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz,
stereo, s16, 1536 kb/s (default)
     Metadata:
       creation_time   : 2012-01-18T12:50:53.000000Z
       handler_name    : Core Media Audio
     Stream #0:2(und): Data: none (tmcd / 0x64636D74)
     Metadata:
       creation_time   : 2012-01-18T12:50:53.000000Z
       handler_name    : Core Media Time Code
       reel_name       : 2001-11-10_KveldsseteKaarvatn
       timecode        : 00:37:50:04


Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'out.mov':
   Metadata:
     major_brand     : qt
     minor_version   : 512
     compatible_brands: qt
     encoder         : Lavf58.33.100
   Duration: 00:03:54.84, start: 0.000000, bitrate: 30333 kb/s
     Stream #1:0: Video: dvvideo (dvcp / 0x70637664), yuv420p(bottom
coded first (swapped)), 720x576 [SAR 16:15 DAR 4:3], 28800 kb/s, SAR
59:54 DAR 295:216, 25 fps, 25 tbr, 25k tbn, 25 tbc (default)
     Metadata:
       handler_name    : Core Media Video
       encoder         : DV - PAL
       timecode        : 00:37:50:04
     Stream #1:1: Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz,
stereo, s16, 1536 kb/s (default)
     Metadata:
       handler_name    : Core Media Audio
     Stream #1:2: Data: none (tmcd / 0x64636D74)
     Metadata:
       handler_name    : Core Media Time Code
       reel_name       : 2001-11-10_KveldsseteKaarvatn
       timecode        : 00:37:50:04
At least one output file must be specified









_______________________________________________
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: Copy all metadata fields?

Ulf Zibis
Hi Peter,

you can use "-map_metadata 0".
It copies all possible metadata from input to output.

-Ulf

Am 18.03.20 um 07:49 schrieb Peter B.:

> Hi everyone!
>
> Is it possible to ask/force FFmpeg to keep as many metadata fields as technically possible when transcoding or rewrapping?
>
> I understand that not all (container-)formats support the same metadata fields, but I've noticed for example that when rewrapping, not all metadata fields that were populated in the input are then present in the output - even if the format is identical.
>
>
> Here is an example of rewrapping MOV to MOV where I've noticed the following data missing in the output (commandline and output see below):
>
>   * color information (smpte170m/bt470bg/bt709)
>   * creation_time (*)
>
>
> I'm grateful for any hints or suggestions!
> Thank you in advance,
> Peter
>
> (*) Copying "creation_time" may be controversial, but it would be amazing to be able to preserve this information in the output (e.g. map it to a different field?).
>
>
>
>
> Files were created with the following command:
> // ------------------------
> $ ffmpeg -i in.mov -c copy -map 0 out.mov
> // ------------------------
>
>
> Then metadata checked as follows:
> // ------------------------
> $ ffmpeg -i in.mov -i out.mov -hide_banner
> // ------------------------
>
>
>
> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'in.mov':
>   Metadata:
>     major_brand     : qt
>     minor_version   : 0
>     compatible_brands: qt
>     creation_time   : 2012-01-18T12:50:53.000000Z
>   Duration: 00:03:54.80, start: 0.000000, bitrate: 30453 kb/s
>     Stream #0:0(und): Video: dvvideo (dvcp / 0x70637664), yuv420p(smpte170m/bt470bg/bt709, bottom coded first (swapped)), 720x576 [SAR 16:15 DAR 4:3], 28800 kb/s, SAR 59:54 DAR 295:216, 25 fps, 25 tbr, 25k tbn, 25 tbc (default)
>     Metadata:
>       creation_time   : 2012-01-18T12:50:53.000000Z
>       handler_name    : Core Media Video
>       encoder         : DV - PAL
>       timecode        : 00:37:50:04
>     Stream #0:1(und): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, stereo, s16, 1536 kb/s (default)
>     Metadata:
>       creation_time   : 2012-01-18T12:50:53.000000Z
>       handler_name    : Core Media Audio
>     Stream #0:2(und): Data: none (tmcd / 0x64636D74)
>     Metadata:
>       creation_time   : 2012-01-18T12:50:53.000000Z
>       handler_name    : Core Media Time Code
>       reel_name       : 2001-11-10_KveldsseteKaarvatn
>       timecode        : 00:37:50:04
>
>
> Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'out.mov':
>   Metadata:
>     major_brand     : qt
>     minor_version   : 512
>     compatible_brands: qt
>     encoder         : Lavf58.33.100
>   Duration: 00:03:54.84, start: 0.000000, bitrate: 30333 kb/s
>     Stream #1:0: Video: dvvideo (dvcp / 0x70637664), yuv420p(bottom coded first (swapped)), 720x576 [SAR 16:15 DAR 4:3], 28800 kb/s, SAR 59:54 DAR 295:216, 25 fps, 25 tbr, 25k tbn, 25 tbc (default)
>     Metadata:
>       handler_name    : Core Media Video
>       encoder         : DV - PAL
>       timecode        : 00:37:50:04
>     Stream #1:1: Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, stereo, s16, 1536 kb/s (default)
>     Metadata:
>       handler_name    : Core Media Audio
>     Stream #1:2: Data: none (tmcd / 0x64636D74)
>     Metadata:
>       handler_name    : Core Media Time Code
>       reel_name       : 2001-11-10_KveldsseteKaarvatn
>       timecode        : 00:37:50:04
> At least one output file must be specified
>
>
>
>
>
>
>
>
>
> _______________________________________________
> 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: Copy all metadata fields?

Paul B Mahol
On 3/18/20, Ulf Zibis <[hidden email]> wrote:
> Hi Peter,
>
> you can use "-map_metadata 0".
> It copies all possible metadata from input to output.

I'm sure that color information is not part of that metadata.
And it must be set manually.


>
> -Ulf
>
> Am 18.03.20 um 07:49 schrieb Peter B.:
>> Hi everyone!
>>
>> Is it possible to ask/force FFmpeg to keep as many metadata fields as
>> technically possible when transcoding or rewrapping?
>>
>> I understand that not all (container-)formats support the same metadata
>> fields, but I've noticed for example that when rewrapping, not all
>> metadata fields that were populated in the input are then present in the
>> output - even if the format is identical.
>>
>>
>> Here is an example of rewrapping MOV to MOV where I've noticed the
>> following data missing in the output (commandline and output see below):
>>
>>   * color information (smpte170m/bt470bg/bt709)
>>   * creation_time (*)
>>
>>
>> I'm grateful for any hints or suggestions!
>> Thank you in advance,
>> Peter
>>
>> (*) Copying "creation_time" may be controversial, but it would be amazing
>> to be able to preserve this information in the output (e.g. map it to a
>> different field?).
>>
>>
>>
>>
>> Files were created with the following command:
>> // ------------------------
>> $ ffmpeg -i in.mov -c copy -map 0 out.mov
>> // ------------------------
>>
>>
>> Then metadata checked as follows:
>> // ------------------------
>> $ ffmpeg -i in.mov -i out.mov -hide_banner
>> // ------------------------
>>
>>
>>
>> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'in.mov':
>>   Metadata:
>>     major_brand     : qt
>>     minor_version   : 0
>>     compatible_brands: qt
>>     creation_time   : 2012-01-18T12:50:53.000000Z
>>   Duration: 00:03:54.80, start: 0.000000, bitrate: 30453 kb/s
>>     Stream #0:0(und): Video: dvvideo (dvcp / 0x70637664),
>> yuv420p(smpte170m/bt470bg/bt709, bottom coded first (swapped)), 720x576
>> [SAR 16:15 DAR 4:3], 28800 kb/s, SAR 59:54 DAR 295:216, 25 fps, 25 tbr,
>> 25k tbn, 25 tbc (default)
>>     Metadata:
>>       creation_time   : 2012-01-18T12:50:53.000000Z
>>       handler_name    : Core Media Video
>>       encoder         : DV - PAL
>>       timecode        : 00:37:50:04
>>     Stream #0:1(und): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz,
>> stereo, s16, 1536 kb/s (default)
>>     Metadata:
>>       creation_time   : 2012-01-18T12:50:53.000000Z
>>       handler_name    : Core Media Audio
>>     Stream #0:2(und): Data: none (tmcd / 0x64636D74)
>>     Metadata:
>>       creation_time   : 2012-01-18T12:50:53.000000Z
>>       handler_name    : Core Media Time Code
>>       reel_name       : 2001-11-10_KveldsseteKaarvatn
>>       timecode        : 00:37:50:04
>>
>>
>> Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'out.mov':
>>   Metadata:
>>     major_brand     : qt
>>     minor_version   : 512
>>     compatible_brands: qt
>>     encoder         : Lavf58.33.100
>>   Duration: 00:03:54.84, start: 0.000000, bitrate: 30333 kb/s
>>     Stream #1:0: Video: dvvideo (dvcp / 0x70637664), yuv420p(bottom coded
>> first (swapped)), 720x576 [SAR 16:15 DAR 4:3], 28800 kb/s, SAR 59:54 DAR
>> 295:216, 25 fps, 25 tbr, 25k tbn, 25 tbc (default)
>>     Metadata:
>>       handler_name    : Core Media Video
>>       encoder         : DV - PAL
>>       timecode        : 00:37:50:04
>>     Stream #1:1: Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, stereo,
>> s16, 1536 kb/s (default)
>>     Metadata:
>>       handler_name    : Core Media Audio
>>     Stream #1:2: Data: none (tmcd / 0x64636D74)
>>     Metadata:
>>       handler_name    : Core Media Time Code
>>       reel_name       : 2001-11-10_KveldsseteKaarvatn
>>       timecode        : 00:37:50:04
>> At least one output file must be specified
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> 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".
_______________________________________________
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: Copy all metadata fields?

Peter B.
Thanks Ulf, Thanks Paul!

On 18/03/2020 11:14, Paul B Mahol wrote:
> On 3/18/20, Ulf Zibis <[hidden email]> wrote:
>> Hi Peter,
>>
>> you can use "-map_metadata 0".
>> It copies all possible metadata from input to output.

"-map_metadata 0": Ah, how can I have overlooked that?
Thank you!

Now more metadata is present in the output, but according to Mediainfo
there still differences:
(Sorry for being picky ;P)


1) "tagged date" overwritten by "encoded date"
================================

In original MOV:
   * Encoded date : UTC 2012-01-18 12:50:53
   * Tagged date : UTC 2012-01-18 12:54:48

In rewrapped MOV:
   * Encoded date : UTC 2012-01-18 12:50:53
   * Tagged date : UTC 2012-01-18 12:50:53

I cannot find the "tagged date" value in the source file using
ffmpeg/ffprobe - only Mediainfo. But there seems to be a difference
between source and target after rewrapping.


1) "TIM" missing in output
================================

FFmpeg copies timecode information from the video stream, but Mediainfo
also shows "TIM" in the source container. Is it on purpose that this
timecode field is not kept?

One could argue that this is trivial, but for preservation we're trying
to keep as much of the source "as-is" :)


> I'm sure that color information is not part of that metadata.
> And it must be set manually.

Oh, and yes: absolutely correct! Color information is gone.
Is there any way that this kind of metadata can also be transferred -
even if I don't explicitely know it's there?

The use case is that literally thousands of files are automatically
rewrapped/transcoded and the source material can be very
heterogeneous... Lots of fun!


Again, I'm grateful for any hints or input on how I can preserve as much
of the original (tech)-metadata as possible.


Thanks again!
Peter
_______________________________________________
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: Copy all metadata fields?

Kieran O Leary
Hi,

On Wed 18 Mar 2020, 12:54 Peter B., <[hidden email]> wrote:

>
> Oh, and yes: absolutely correct! Color information is gone.
> Is there any way that this kind of metadata can also be transferred -
> even if I don't explicitely know it's there?
>

I raised this before and I think you have to set the output values
manually. I found this when Transcoding from mov to mkv, colour values were
lost.
Tobias's advice here still stands I think
https://ffmpeg.org/pipermail/ffmpeg-user/2018-July/040717.html

Best,

Kieran
_______________________________________________
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: Copy all metadata fields?

Peter B.
On 18/03/2020 14:29, Kieran O Leary wrote:
> On Wed 18 Mar 2020, 12:54 Peter B., <[hidden email]> wrote:
>> Oh, and yes: absolutely correct! Color information is gone.
>> Is there any way that this kind of metadata can also be transferred -
>> even if I don't explicitely know it's there?
> I raised this before and I think you have to set the output values
> manually. I found this when Transcoding from mov to mkv, colour values were
> lost.
> Tobias's advice here still stands I think
> https://ffmpeg.org/pipermail/ffmpeg-user/2018-July/040717.html

I remember seeing this back then. I'll read it again. Thanks for
pointing it out Kieran!

The mentioned patch "Pass colour range from source to sink"
(https://ffmpeg.org/pipermail/ffmpeg-devel/2018-February/225512.html) by
Philip Langdale sounds to me like it would enable this.

Quote:
// --------------------
"However, we don't support a way to pass it through filter chains and
'ffmpeg' does not make any attempt to set it on the encoder.

This set of changes introduces a way to do this, by defining a new
filter link property, and allowing it to be set on a buffersrc and
read back from a buffersink."
// --------------------


 From taking a quick peek at the related thread(s), it looks like Philip
never replied to Michael's questions/comments.
Does anyone know what happened to this idea/feature/patch?



Thanks in advance!
Peter

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