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

Feature request: Preserve metadata after conversion. #345

Open
Malko29 opened this issue Sep 28, 2016 · 60 comments
Open

Feature request: Preserve metadata after conversion. #345

Malko29 opened this issue Sep 28, 2016 · 60 comments
Labels
Milestone

Comments

@Malko29
Copy link

@Malko29 Malko29 commented Sep 28, 2016

Hi, can we get a enhancement in handbrake for preserving the metadata after converting videos.
Most of the time I have to use ffmpeg with map_metadata to preserve metadata. And it is not user-friendly.

Is there any possibility in handbrake?

@sr55 sr55 added the Enhancement label Oct 2, 2016
@sr55
Copy link
Contributor

@sr55 sr55 commented Oct 2, 2016

While there isn't any interest in adding a really good meta data UI, passthru may be an option. We can disucss and decide later. Right now we are concentrating on getting 1.0 out the door.

@jstebbins
Copy link
Contributor

@jstebbins jstebbins commented Oct 5, 2016

What additional metadata are you interested in?

HB already preserves title, artist director, composer, release date, summary, genre, description, and synopsis from any file demuxed by libav (so everything other than BD and DVD sources).

I've done some brief testing with mkv sources to verify no bugs have crept in. But if you see a problem with other source types, please let us know.

@sr55
Copy link
Contributor

@sr55 sr55 commented Oct 6, 2016

Not actually tested it. Does it require the metadata json block to be popualted? I don't do that at the moment.

@jstebbins
Copy link
Contributor

@jstebbins jstebbins commented Nov 2, 2016

Sorry, I forgot to get back to you about this question. hb_job_init, hb_job_init_json and hb_preset_job_init copy the title's metadata into the job they create. So if you are initializing your job with any of these, the metadata should already be there.

@bradleysepos
Copy link
Contributor

@bradleysepos bradleysepos commented Dec 29, 2016

HB already preserves title, artist director, composer, release date, summary, genre, description, and synopsis from any file demuxed by libav (so everything other than BD and DVD sources).

I know the Linux GTK GUI has more metadata stuffs. Wondering if it's useful to add an option to preserve or remove additional metadata fields other than the above. For example:

|x| Title
|x| Artist
|x| Description
|x|

Other metadata:
  (o) Passthru
  ( ) Remove

Could also be a checkbox but the explicit nature of the radio control seems more suited for clarity.

@bradleysepos bradleysepos added this to the Unscheduled milestone Dec 29, 2016
@sr55
Copy link
Contributor

@sr55 sr55 commented Dec 29, 2016

Your close enough to just adding a MetaData tab to the GUI at that point.

I'm still on the shelf about that. I have been wanting to write a Subler clone for windows for some time though. Just not found the time.

I had thought about tight integration with the likes of Subler. I.e HandBrake could launch super pre-encode, store the info and let Subler tag it afterwords. So you get the Power of Subler, without writing much code.

Otherwise you'll end up with requests for connecting to various meta data websites, adding fields and all the other nice stuff Subler has anyway.

@bradleysepos
Copy link
Contributor

@bradleysepos bradleysepos commented Dec 29, 2016

Your close enough to just adding a MetaData tab to the GUI at that point.

GTK has a tab for this. Fields are minimal, useful for clarifying what's happening and changing some very basic properties.

I absolutely agree we shouldn't get into tagging beyond this. My suggestion is to improve upon the GTK implementation with a catch-all for the rest of the metadata we don't plan to mess around with.

@bradleysepos
Copy link
Contributor

@bradleysepos bradleysepos commented Dec 29, 2016

I had thought about tight integration with the likes of Subler. I.e HandBrake could launch super pre-encode, store the info and let Subler tag it afterwords. So you get the Power of Subler, without writing much code.

Agreed, it would be cool if Subler had an API we could access programmatically.

@bradleysepos
Copy link
Contributor

@bradleysepos bradleysepos commented Dec 29, 2016

Screenshot of the GTK Tags tab:

handbrake-gtk-tags

@cortig
Copy link

@cortig cortig commented Jan 23, 2017

I noticed that some of the field are properly preserved, but the cover art for instance is lost. Content and Advisory Ratings are lost too from what I remember.

@mmattel
Copy link

@mmattel mmattel commented Jun 11, 2017

When you create videos with a camera, a timestamp and GPS info is (most times) added.
It would be great if this can be preserved.

@gregalex72
Copy link

@gregalex72 gregalex72 commented Jul 28, 2017

Is this likely to happen?

I'd love to convert my 1080i50 h264 content to 1080p50 while keeping timecodes (iMovie and Photos just blends it to 1080p25).

Actually... 1080i50 h264 converted to 1080p50 HEVC with timecodes will be a great conversion for the new Mac "High Sierra" in a couple of months.

@martijnspaan
Copy link

@martijnspaan martijnspaan commented Aug 15, 2017

Would be an awesome feature to preserve the meta data. When I convert my files on Windows 10, the new file has 'date created' and 'date modified' set to the day of the conversion. Would be great if it could have the creation date of the original file.

E.g. this stackoverflow post has a solution by using ffmpeg, so should be fairly easy to implement in Handbrake, which is already using it.

@tmchow
Copy link

@tmchow tmchow commented Oct 26, 2017

+1 for preserving some metadata. The key one, like @martijnspaan mentioned is the "date created" and "date modified". In particular, when I'm converting older family videos to conserve file space, I don't want to muck with the date modified so it imports into digital libraries correctly like Google Photos.

@StephKoenig
Copy link

@StephKoenig StephKoenig commented Feb 3, 2018

+1 for preserving meta as well...

I think use cases described above are leading the developers into considering (then obviously discounting) a full meta data editing tab. This is obviously a chunk of work. There's plenty of 3rd party tools to do this already for things like commercial movies etc.. MetaX for example happily adds film meta mkv/mp4 alike.

Also HB isn't just for (commercial) movies, I use it extensively to shrink family movies made on inefficient cameras - where the difference between 264 quick saved on a battery/processor limited camera to 265 can be huge. In this use case it's incredibly important to preserve the metadata already created - geo, time date, aperture, white balance blah blah blah because there's no way to add them back (easily) afterwards without laboriously saving them and then re-adding them.. cloud image/video libraries such as google photos/flickr etc largely do their magic because they can use this meta data very effectively for albums, image processing and improvement etc.

So simply preserving meta data (either added before hand for movies via something like metaX or embedded by cameras first hand) would be ideal and not as much work as a full meta data editing tab with all the error checking etc that would involve.

@bradleysepos
Copy link
Contributor

@bradleysepos bradleysepos commented Feb 3, 2018

I don't think we have any objection to preserving (passing through) existing metadata, just haven't implemented it extensively yet. IIRC there was a patch on our old ReviewBoard to preserve more than we do now, but it's likely far out of date by now.

@flin-8
Copy link

@flin-8 flin-8 commented Feb 17, 2018

Where's the code that requires the changes to preserve say the created date? Is it inside libhb or the c# solution?

@misterbridge
Copy link

@misterbridge misterbridge commented Mar 31, 2018

So it that going to happen anytime soon ? Such a needed feature, that would really be amazing !
Great job on the tool, it is awesome.

@sr55
Copy link
Contributor

@sr55 sr55 commented Mar 31, 2018

It's not high up on anyone's todo list, sorry.

@diegoteliz
Copy link

@diegoteliz diegoteliz commented Jun 13, 2018

What about approaching this in 2 phases?

Phase 1

Preserving "date created" and "date modified" (for all those who are converting older family videos to save space).
Since HB already preserves some other metadata, it doesn't seem to be too complicated to implement (?)

Perhaps a checkbox under Preferences\Output files:

  • Keep original file Creation and Modification dates

Phase 2

Adding a MetaData tab to the GUI for additional values (or a similar solution)

@sr55
Copy link
Contributor

@sr55 sr55 commented Jun 13, 2018

This issue is about retention of container metadata, not filesystem metadata.

All I can suggest is you create a small powershell script that gets executed using the "When Done" feature in preferences. Stackoverflow has examples of how to set filesystem metadata this way but it's not something i'd recommend doing in the first place.

@jeroen020
Copy link

@jeroen020 jeroen020 commented Jun 25, 2018

Having this feature would totally rock my world. I have hundreds of GBs of videos collected over a decade that I'd love to convert to H265 in batch but as they don't have any tags I rely fully on their creation date for meta data.
One thing that may make this easier is that this feature was previously present in HandBrakeBatch, but the developer stopped updating it unfortunately... But code is on Github so you can see how to implement keeping the date stamps the same.

@fmvdb
Copy link

@fmvdb fmvdb commented Jul 15, 2018

Would be great to have HandBrake keep the original EXIF information. Any progress on this?

@sr55
Copy link
Contributor

@sr55 sr55 commented Jul 15, 2018

Nothing has changed.

@fmvdb
Copy link

@fmvdb fmvdb commented Jul 23, 2018

Can we do anything to increase the priority for this request?

@sr55
Copy link
Contributor

@sr55 sr55 commented Jul 23, 2018

Nope, Afraid not.

@trymeouteh
Copy link

@trymeouteh trymeouteh commented Jul 3, 2019

I would like this also, especially for the "Recording Date" "Encoding Date" and GPS data. It will make my sorting of family videos so much more easier every month.

Is there any good Linux apps that can preserve metadata of videos?

@metal450
Copy link

@metal450 metal450 commented Jul 5, 2019

Thought I'd give Handbrake a try (transcoding my drone videos to h265). First thing I noticed is it dumps all the meta, unfortunately making it unusable for this purpose. Will follow this request with interest, & I guess use ffmpeg directly in the interim.

@garrytaulu
Copy link

@garrytaulu garrytaulu commented Aug 21, 2019

Thought I'd give Handbrake a try (transcoding my drone videos to h265). First thing I noticed is it dumps all the meta, unfortunately making it unusable for this purpose. Will follow this request with interest, & I guess use ffmpeg directly in the interim.

Do you mind sharing how you're doing this with ffmpeg? It's been 7 months and I still haven't got around to backing up family videos as I just lose all metadata with Handbrake.

@StephKoenig
Copy link

@StephKoenig StephKoenig commented Aug 21, 2019

Do you mind sharing how you're doing this with ffmpeg? It's been 7 months and I still haven't got around to backing up family videos as I just lose all metadata with Handbrake.

For ffmpeg use the below switches
-map_metadata 0
and/or for mp4/mov containers
-movflags use_metadata_tags

https://ffmpeg.org/ffmpeg.html#Advanced-options

@metal450
Copy link

@metal450 metal450 commented Aug 21, 2019

Was this option added recently? I don't see it mentioned as having just been added in 4.2 release...

@StephKoenig
Copy link

@StephKoenig StephKoenig commented Aug 21, 2019

https://www.google.com/search?q=ffmpeg+map_metadata
I see mentions on page one going back to 2016 so it's been there a while

https://www.google.com/search?q=ffmpeg+movflags+use_metadata_tags
Seems to be from 2017 or earlier

You can search the code of course for a more accurate timeframe

@metal450
Copy link

@metal450 metal450 commented Aug 21, 2019

Wait, those are the ffmpeg options (discussed multiple times above) - are you saying handbrake supports these flags too? Per all of the other comments above, it doesn't. Ffmpeg does, but we're discussing Handbrake here.

@sr55
Copy link
Contributor

@sr55 sr55 commented Aug 21, 2019

Nope, HandBrake doesn't use ffmpeg CLI. You need to use ffmpeg as a separate tool.

@StephKoenig
Copy link

@StephKoenig StephKoenig commented Aug 21, 2019

Was this option added recently? I don't see it mentioned as having just been added in 4.2 release...

Yes they were ffmpeg flag, let me amend my reply to make it clear. I was replying the post above asking what the options in ffmpeg were. I assumed you were also asking about ffmpeg because you mentioned 4.2 and not seeing them mentioned in that release...

Handbrake doesn't support those and doesn't yet support meta data preservation/copying.

@metal450
Copy link

@metal450 metal450 commented Aug 21, 2019

Yeah - I just clicked the link you posted, didn't notice it wasn't for Handbrake, which is what this issue is for.

The ffmpeg flag is already mentioned by this issue's OP (very first comment above). I figured you were posting some new info that pertains to handbrake, didn't notice it was just a repeat of the OP's premise.

@StephKoenig
Copy link

@StephKoenig StephKoenig commented Aug 21, 2019

I get the topic and the duplication. I was answering his question. I could have referenced marcelbrueckner answer above but he missed the movflags option.

@DmitryDemidov
Copy link

@DmitryDemidov DmitryDemidov commented Oct 14, 2019

This would be a very useful feature, please add it.

@zeeefix
Copy link

@zeeefix zeeefix commented Oct 28, 2019

In the meanwhile you can use the tool BulkFileChanger to easily copy the time/date tags from the original mp4 files to the converted ones - even the special tag 'date encoded' in the media exif.
Unbelievable that this old tool does exactly what we're looking for and what we're missing in nowadays converters!

@mmattel
Copy link

@mmattel mmattel commented Oct 28, 2019

Hard to understand that this feature request is now present for 3 years but completely ignored 😟

@jstebbins
Copy link
Contributor

@jstebbins jstebbins commented Oct 28, 2019

None of the current HandBrake developers has a particular interest in metadata. So it's unlikely to get any attention. Speaking for myself, I just don't have enough bandwidth to spend time on things that are not of interest to me.

But in the spirit of moving this forward a notch, we need to create a list of the things that are of interest to users here. As things stand right now, there's not a lot of actionable information in this issue. I asked once already here #345 (comment) and got no direct replies. But there have been a few random comments. "Keep all metadata" is not a practical request because metadata comes in a variety of forms that require unique processing for each. Each container has it's own way of representing metadata and it's own keys for indexing the data. Also, ffmpeg may not support all the metadata types I've seen requested. So work may be required on ffmpeg as well. We need a list of what is actually wanted so it can be prioritized and scheduled.

Here are the detailed requests I've seen so far.

  • creation date/time
  • encoding date/time
  • GPS/location
  • EXIF data
  • content advisory ratings
  • cover art

On a number of occasions, people have requested that we modify the file system creation time of HandBrake's output file to make it the same as the source files creation time. Note that I'm not talking about file metadata here, but rather file system data. This is a bad idea for a number of reasons. But there's an alternative that I think is better. If the source doesn't have a creation time metadata tag, read the file system creation time of the source and write that as the output file's creation time metadata. This way the information isn't lost and actually gets written where it should have been in the first place.

@tmchow
Copy link

@tmchow tmchow commented Oct 28, 2019

@jstebbins i think the most important things to preserve are

  1. creation date/time
  2. EXIF data
  3. GPS/location
@DmitryDemidov
Copy link

@DmitryDemidov DmitryDemidov commented Oct 28, 2019

None of the current HandBrake developers has a particular interest in metadata. So it's unlikely to get any attention. Speaking for myself, I just don't have enough bandwidth to spend time on things that are not of interest to me.

But in the spirit of moving this forward a notch, we need to create a list of the things that are of interest to users here. As things stand right now, there's not a lot of actionable information in this issue. I asked once already here #345 (comment) and got no direct replies. But there have been a few random comments. "Keep all metadata" is not a practical request because metadata comes in a variety of forms that require unique processing for each. Each container has it's own way of representing metadata and it's own keys for indexing the data. Also, ffmpeg may not support all the metadata types I've seen requested. So work may be required on ffmpeg as well. We need a list of what is actually wanted so it can be prioritized and scheduled.

Here are the detailed requests I've seen so far.

  • creation date/time
  • encoding date/time
  • GPS/location
  • EXIF data
  • content advisory ratings
  • cover art

On a number of occasions, people have requested that we modify the file system creation time of HandBrake's output file to make it the same as the source files creation time. Note that I'm not talking about file metadata here, but rather file system data. This is a bad idea for a number of reasons. But there's an alternative that I think is better. If the source doesn't have a creation time metadata tag, read the file system creation time of the source and write that as the output file's creation time metadata. This way the information isn't lost and actually gets written where it should have been in the first place.

@jstebbins
In my opinion:

  1. GPS/location
  2. Creation date/time (i can write it in folder name, or in file name)

Very grateful for your work!

@beatschubser
Copy link

@beatschubser beatschubser commented Nov 4, 2019

Passing through the values "createdate" and "modifydate" would be awesome, these are the ones I always need to fix after compressing videos from my Smartphone.

On a number of occasions, people have requested that we modify the file system creation time of HandBrake's output file to make it the same as the source files creation time.

This is indeed a bad idea, because Android ignores file system data if the meta data values "createdate" and "modifydate" exist. Windows-explorer too uses the meta data to display the "Date"-attribute.

@lylek
Copy link

@lylek lylek commented Dec 8, 2019

I would also like to have an option to preserve metadata, especially creation date and location. Currently I'm using slhck's workaround I found on superuser:

You can copy the existing metadata from one file to another without needing to re-encode the video using FFmpeg. It basically takes one second. To do this, let's assume three files:

  • in.mp4 – the original file before conversion
  • out.mp4 – the file after Handbrake conversion
  • fixed.mp4 – the file with "corrected" metadata

The FFmpeg command to copy the complete metadata record to the new file would then be:

ffmpeg -i in.mp4 -i out.mp4 -map 1 -map_metadata 0 -c copy fixed.mp4

[…]
After that, you could obviously rename fixed.mp4 to out.mp4.

Tried this, unfortunately it did not copy the metadata, specifically the GPS data. In my case my IN file was an .MOV (HEVC) and my OUT file was a .M4V, and FIXED was an .M4V, not sure if that makes a difference.

How do I know it didn't copy the GPS data? Well, I ran exiftool on the original file and the fixed file. It showed GPS coordinates in the original IN file but not the FIXED file.

However, it did copy some other metadata, such as timestamps, correctly.

@lylek
Copy link

@lylek lylek commented Dec 8, 2019

Update: I was able to copy the GPS metadata using a different tool called Bento. See this topic: https://exiftool.org/forum/index.php?topic=7826.0. Bento gives more precise control over metadata than exiftool. In my case the commands were:

mp4extract moov/meta img_0014.mov temp.txt
mp4edit --insert moov:temp.txt IMG_0014.M4V IMG_0014_GPS.M4V

This is specifically for Apple iPhone metadata. I shot the videos on my iPhone with HEVC, but Lightroom on Windows doesn't support HEVC, so I had to convert the files to H.264.

@adamradocz
Copy link

@adamradocz adamradocz commented Jan 7, 2020

Update: I was able to copy the GPS metadata using a different tool called Bento. See this topic: https://exiftool.org/forum/index.php?topic=7826.0. Bento gives more precise control over metadata than exiftool. In my case the commands were:

mp4extract moov/meta img_0014.mov temp.txt
mp4edit --insert moov:temp.txt IMG_0014.M4V IMG_0014_GPS.M4V

This is specifically for Apple iPhone metadata. I shot the videos on my iPhone with HEVC, but Lightroom on Windows doesn't support HEVC, so I had to convert the files to H.264.

You have to download the HEVC plugin from Windows Store and it'll work.

@cfelicio
Copy link

@cfelicio cfelicio commented Apr 21, 2020

Also interested in at least preserving these:

Encoded Date
Tagged Date
Mastered Date

Different video formats have different metadata. If handbrake relies on ffmpeg behind the scenes, I'm wondering if it would just be easier to pass something like -map_metadata 0 behind the scenes between source and output files as a post processing step?

@dradutu
Copy link

@dradutu dradutu commented May 13, 2020

would love to be able to keep the metadata or at least be able to add it in the output's naming scheme

@mwweber
Copy link

@mwweber mwweber commented May 14, 2020

I'm trying to compress dozens of 1080p videos from iCloud, which relies on dates to organize everything. Adding a checkbox to preserve the original date is a great idea. PhotoConvert 4 on Mac does this very effectively: https://i.imgur.com/OiAnEQp.png. So does Lightweight PDF.

With the proliferation of very high resolution cameras in our phones, it's bound to become even more important to compress videos without messing up our photo libraries.

@cortig
Copy link

@cortig cortig commented May 14, 2020

I'm trying to compress dozens of 1080p videos from iCloud, which relies on dates to organize everything.

That’s the main issue I have as well fr the very same reason. Obviously I’d like all other metadata to be preserved, but the creation date is the main one for anything I shoot on various devices.
For that sort of things, I have to use either ff Works or Permute on my Mac (they have special preferences to preserve that).

@jeroen020
Copy link

@jeroen020 jeroen020 commented May 14, 2020

For that sort of things, I have to use either ff Works or Permute on my Mac (they have special preferences to preserve that).

While I still have a sliver of hope that the recent comments will convince the developers to add this feature, it's been asked since 2016 so I stopped expecting anything. I wouldn't mind using other tools than Handbrake for (batch) conversion and have dabbled with Compressor. But ffworks or Permute are new to me, would you recommend them? It looks like they do h265/HEVC, which is a requirement for me. How do they handle batch jobs?

@bradleysepos
Copy link
Contributor

@bradleysepos bradleysepos commented May 14, 2020

While I still have a sliver of hope that the recent comments will convince the developers to add this feature

The issue is open, not rejected. Nobody has made time or shown interest, yet. We're a very small team and none of us work on HandBrake full time.

Thanks for understanding. Some of these things may happen, it's just hard to say when.

@sr55
Copy link
Contributor

@sr55 sr55 commented May 14, 2020

Just a reminder that those of you using Windows Nightly builds can utilise the Send File To Option. Either to ffmpeg or a script. You can do the same on mac but it's a little more tricky to script it on that platform as you only get the destination.

image

and use the examples above to map metadata.

@GLLM
Copy link

@GLLM GLLM commented May 15, 2020

I'm on linux, so I cannot use this GUI feature, but if people are looking to do something with exiftool, here is what you can use : exiftool -overwrite_original -tagsfromfile {source} {destination}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
You can’t perform that action at this time.