Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserving Video Metadata When Watermarking #57

Open
tim-janik opened this issue Apr 19, 2024 · 0 comments
Open

Preserving Video Metadata When Watermarking #57

tim-janik opened this issue Apr 19, 2024 · 0 comments

Comments

@tim-janik
Copy link
Contributor

Hi.
When using videowmark to watermark an MP4 file, it successfully reads the MP4 and adds the watermark, but seems to loose some of the metadata, according to mediainfo.

$ videowmark add BigBuckBunny_320x180.mp4 BigBuckBunny_WM.mp4 0000111100002222
$ mediainfo BigBuckBunny_320x180.mp4 >x1
$ mediainfo BigBuckBunny_WM.mp4 >x2
$ diff -u x1 x2

The differences are as follows:

--- x1	2024-04-19 12:05:44.013193748 +0200
+++ x2	2024-04-19 12:05:49.757202964 +0200
@@ -1,19 +1,16 @@
 General
-Complete name                            : BigBuckBunny_320x180.mp4
+Complete name                            : BigBuckBunny_WM.mp4
 Format                                   : MPEG-4
 Format profile                           : Base Media
-Codec ID                                 : isom (mp41)
+Codec ID                                 : isom (isom/iso2/avc1/mp41)
 File size                                : 61.7 MiB
 Duration                                 : 9 min 56 s
-Overall bit rate mode                    : Variable
 Overall bit rate                         : 867 kb/s
 Movie name                               : Big Buck Bunny
 Performer                                : Blender Foundation
 Composer                                 : Blender Foundation
 Recorded date                            : 2008
-Encoded date                             : UTC 1970-01-01 00:00:00
-Tagged date                              : UTC 1970-01-01 00:00:00
-Writing application                      : Lavf52.14.0
+Writing application                      : Lavf58.76.100
 
 Video
 ID                                       : 1
@@ -39,8 +36,6 @@
 Scan type                                : Progressive
 Bits/(Pixel*Frame)                       : 0.508
 Stream size                              : 50.0 MiB (81%)
-Encoded date                             : UTC 1970-01-01 00:00:00
-Tagged date                              : UTC 1970-01-01 00:00:00
 Codec configuration box                  : avcC
 
 Audio
@@ -49,15 +44,18 @@
 Format/Info                              : Advanced Audio Codec Low Complexity
 Codec ID                                 : mp4a-40-2
 Duration                                 : 9 min 56 s
-Bit rate mode                            : Variable
-Bit rate                                 : 160 kb/s
+Source duration                          : 9 min 56 s
+Bit rate mode                            : Constant
+Bit rate                                 : 161 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                              : 11.4 MiB (18%)
-Encoded date                             : UTC 1970-01-01 00:00:00
-Tagged date                              : UTC 1970-01-01 00:00:00
+Stream size                              : 11.4 MiB (19%)
+Source stream size                       : 11.4 MiB (19%)
+Default                                  : Yes
+Alternate group                          : 1
+mdhd_Duration                            : 596224

I.e. "Encoded date" and "Tagged date" are lost for both streams, Video and Audio.
Also, is it expected that the audio stream turns from "Bit rate mode: Variable" before watermarking into "Bit rate mode: Constant" after watermarking?

For the record, I've tried to adjust videowmark to preserve the metadata by adding -movflags +faststart+use_metadata_tags -map_metadata 0 to the audio+video merging step. But that tends to also rename matadata tags (e.g. "Movie name"->"title" or "Performer"->"artist) without preserving any dates, so it is not really an improvement.

As for the above metadata loss, is that purely due to the different codecs used during re-encoding, or can metadata loss go beyond that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant