|
Replies:
16
-
Pages:
2
[
1
2
| Next
]
-
Last Post:
30 Oct 19, 17:28
Last Post By: karlmistelberger
|
Threads:
[
Previous
|
Next
]
|
|
Posts:
18
Registered:
18-Sep-2019
|
|
|
Preserving video metadata
Posted:
25 Oct 19, 14:45
|
|
|
I know jAlbum unfortunately doesn't currently make extensive use of metadata in videos, but I nevertheless wanted to preserve the metadata (including GPS data) in the jAlbum conversion process. At least it will be there for anyone who downloads the video. I struggled for hours to figure out how to do it, mainly because (a) ffmpeg documentation leaves something to be desired, and (b) I don't really know what I am doing. Anyway, here's what worked for me, in case anyone else is interested:
1. I needed to update the version of ffmpeg which came with my (relatively recent) jAlbum release. Otherwise my changes below will cause conversion failure. See https://jalbum.net/forum/thread.jspa?threadID=51390&tstart=0
2. Go to Settings/Video and click on 'Use custom settings'. Change the value of the -movflags setting from 'faststart' to '+faststart'. Create a new entry just before this line. The new entry name should also be -movflags, and the value should be 'use_metadata_tags'. Create another new entry (I did this just above the $outputPath entry). This new entry name should be -map_metadata and its value is 0.
A quick way of accomplising the value changes in step 2 would be to open the jalbum-settings.jap file for the album, find the line
videoParameters=-y\=,-i\=$inputPath,-vf\=hqdn3d\\\=1.5\:1.5\:6\:6\\,scale\\\=min(iw\\\\\\,trunc(iw*min($videoWidth/iw\\\\\\,$videoHeight/ih)*0.5)*2)\:min(ih\\\\\\,trunc(ih*min($videoWidth/iw\\\\\\,$videoHeight/ih)*0.5)*2)\\,unsharp\\\=3\:3\:1.0\:3\:3\:0.0\\,$normalizeOrientation,-ss\=$clipStart,-t\=$clipLength,-threads\=0,-b\:a\=96k,-ac\=2,-ar\=44100,-vcodec\=libx264,-crf\=$videoQuality,-metadata\:s\:v\:0\=rotate\\\=0,-movflags\=faststart,-pix_fmt\=yuv420p,$outputPath\=
and replace it with
videoParameters=-y\=,-i\=$inputPath,-vf\=hqdn3d\\\=1.5\:1.5\:6\:6\\,scale\\\=min(iw\\\\\\,trunc(iw*min($videoWidth/iw\\\\\\,$videoHeight/ih)*0.5)*2)\:min(ih\\\\\\,trunc(ih*min($videoWidth/iw\\\\\\,$videoHeight/ih)*0.5)*2)\\,unsharp\\\=3\:3\:1.0\:3\:3\:0.0\\,$normalizeOrientation,-ss\=$clipStart,-t\=$clipLength,-threads\=0,-b\:a\=96k,-ac\=2,-ar\=44100,-vcodec\=libx264,-crf\=$videoQuality,-metadata\:s\:v\:0\=rotate\\\=0,-movflags\=use_metadata_tags,-movflags\=+faststart,-pix_fmt\=yuv420p,-map_metadata\=0,$outputPath\=
This may not preserve all metadata, but it seems to work for at least Quicktime GPS and creation dates.
Edited by: sburke on 25-Oct-2019 15:27
|
|
|
Posts:
3,815
Registered:
4-Aug-2006
|
|
|
Posts:
18
Registered:
18-Sep-2019
|
|
|
Re: Preserving video metadata
Posted:
26 Oct 19, 18:42
in response to: RobM
|
|
|
I wasn't aware of this tool, but I have tried it and it does exactly what I want. Many thanks.
At the risk of hijacking my own thread: I've noticed that although the tool works fine on most of the videos I have tested, it doesn't work on videos taken on an iPhone SE. Here's the metadata from an iPhone 5 video, which works fine:
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
creation_time : 2014-12-25T19:57:37.000000Z
model : iPhone 5
model-eng : iPhone 5
encoder : 7.1.2
encoder-eng : 7.1.2
date : 2014-12-25T19:57:37+0000
date-eng : 2014-12-25T19:57:37+0000
location : +53.7326+000.1260+133.588/
location-eng : +53.7326+000.1260+133.588/
make : Apple
make-eng : Apple
com.apple.quicktime.make: Apple
com.apple.quicktime.creationdate: 2014-12-25T19:57:37+0000
com.apple.quicktime.location.ISO6709: +53.7326+000.1260+133.588/
com.apple.quicktime.software: 7.1.2
com.apple.quicktime.model: iPhone 5
But, for reasons best known to Apple, on an iPhone SE you get:
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
creation_time : 2019-01-31T11:59:28.000000Z
com.apple.quicktime.content.identifier: 3DDF625B-9660-48DE-B3CD-D343FC75BAFC
com.apple.quicktime.location.ISO6709: +27.9298-017.6405+015.962/
com.apple.quicktime.make: Apple
com.apple.quicktime.model: iPhone SE
com.apple.quicktime.software: 11.4
com.apple.quicktime.creationdate: 2019-01-31T11:59:28+0000
I can fiddle around to sort this out but I thought I'd report it.
Thanks again for this excellent tool.
|
|
|
Posts:
3,815
Registered:
4-Aug-2006
|
|
|
Re: Preserving video metadata
Posted:
26 Oct 19, 21:50
in response to: sburke
|
|
|
I wasn't aware of this tool, but I have tried it and it does exactly what I want. Many thanks.
You’re welcome and it is nice to know it is of use.
At the risk of hijacking my own thread: I've noticed that although the tool works fine on most of the videos I have tested, it doesn't work on videos taken on an iPhone SE.
That is odd as both use com.apple.quicktime.location.iso6709:
I can fiddle around to sort this out but I thought I'd report it.
I don’t have an Apple phone (iPad and Mac though) so can’t do any testing myself. If you do get it to work though post the change/modified code here and I will update the tool in the forum post - just let me know if the mod breaks anything for older/other phones you have access to. You could post your own tool if you prefer.
|
|
|
Posts:
18
Registered:
18-Sep-2019
|
|
|
Re: Preserving video metadata
Posted:
27 Oct 19, 13:48
in response to: RobM
|
|
|
I haven't done anything subtle - just changed line 69 from
if(s.indexOf("location ") != -1 && gps.equals("")) {
to
if(((s.indexOf("location ") != -1) || (s.indexOf("location.ISO6709") != -1)) && gps.equals("")) {
and line 77 from
s = s.substring(22);
to
s = s.substring(s.indexOf(":")+1);
I'm afraid I am not able to do extensive testing, but I have used the amended code successfully on videos created by iPhones 5, 5S and SE, an iPad Pro (12.9-inch) (2nd generation) and some MOVs created from AVIs from a couple of old cameras that I had retrospectively geotagged when converting using ffmpeg.
|
|
|
Posts:
3,815
Registered:
4-Aug-2006
|
|
|
Re: Preserving video metadata
Posted:
27 Oct 19, 14:07
in response to: sburke
|
|
|
I'll update the tool as soon as I can.
Thanks for the changes.
|
|
|
Posts:
3,815
Registered:
4-Aug-2006
|
|
|
Re: Preserving video metadata
Posted:
27 Oct 19, 23:38
in response to: RobM
|
|
|
Tool now updated, thanks again.
|
|
|
Posts:
18
Registered:
18-Sep-2019
|
|
|
Re: Preserving video metadata
Posted:
28 Oct 19, 19:49
in response to: RobM
|
|
|
Excellent, RobM, thanks.
Do you know if there is a way of doing something similar with metadata comments and titles in videos? Would it need another tool or is there an easier way? The metadata fields I have used have gone unrecognised, but maybe there are others I should be using.
|
|
|
Posts:
3,815
Registered:
4-Aug-2006
|
|
|
Re: Preserving video metadata
Posted:
28 Oct 19, 21:52
in response to: sburke
|
|
|
Excellent, RobM, thanks.
Do you know if there is a way of doing something similar with metadata comments and titles in videos? Would it need another tool or is there an easier way? The metadata fields I have used have gone unrecognised, but maybe there are others I should be using.
I don't really know the answer to your question, but if you can provide a small video file with such metadata as you have used I am happy to have a look to see if I can do anything with it.
|
|
|
Posts:
8,039
Registered:
31-Jan-2006
|
|
|
Re: Preserving video metadata
Posted:
28 Oct 19, 21:57
in response to: RobM
|
|
|
With a sample video file, I can help with this, too. A couple of months ago we were messing with video metadata, trying to work out some time stamp problems with Drew Noakes. I still have a test skin set up that spits out all the metadata fields that the metadata extractor can currently read.
|
|
|
Posts:
18
Registered:
18-Sep-2019
|
|
|
Re: Preserving video metadata
Posted:
29 Oct 19, 16:11
in response to: JeffTucker
|
|
|
|
Many thanks for the offers to help.
I have attached four video clips. They all have comment/title metadata, but none of this is visible in jAlbum using List metadata :
100_0776v1.mov - this is a clip which was converted using ffmpeg from an old camera AVI. In the conversion I added comments/title using the -metadata comment= and -metadata title= flags. The metadata is visible in VLC, ffplay.exe and exiftool.exe. This video doesn't play properly in jAlbum, possibly because of the codec.
100_0776v2.mp4 - this is 100_0776v1.mov converted to compressed mp4 for use in jAlbum, preserving the metadata. The metadata is visible in ffplay.exe and exiftool.exe but not VLC.
IMG_0806ver1.mp4 - a conversion of an iPhone .mov clip, with metadata (again) added during the ffmpeg conversion. The metadata is visible in ffplay.exe and exiftool.exe but not VLC.
IMG_0806ver2.mp4 - a conversion of the same iPhone .mov clip, with metadata added subsequently using exiftool. The metadata is in xmp-dc:title and xmp-dc:description, and is visible in exiftool but not ffplay.exe nor VLC.
I'm guessing that a tool to extract the metadata would not be too difficult, but I wouldn't know what to do with it after I got it.
|
|
|
Posts:
8,039
Registered:
31-Jan-2006
|
|
|
Re: Preserving video metadata
Posted:
29 Oct 19, 16:45
in response to: sburke
|
|
|
|
Video metadata is truly a minefield.
I think the bottom line is that the metadata extractor being used in jAlbum (by Drew Noakes), is not yet capable of extracting xmp metadata from a video. I'm guessing that's where your added metadata are being stored.
Here are some quick results:
100_0776v1.mov: The metadata extractor blows up on this one, and can't extract anything at all from it. I'm guessing this file is using a metadata structure that's truly obsolete, so it might still be supported in some packages. But not this one!
100_0776v2.mp4: Attached is everything the metadata extractor can grab - v2metaout.txt, attached.
IMG_0806ver1.mp4: See ver1metaout.txt.
IMG_0806ver2.mp4: See ver2metaout.txt
All four produce a working video once jAlbum converts them, even the first one. I'm testing with Minimal, which uses a simple HTML <video> tag on the page, so it's down to the browser to play the video, with no third-party scripting involved.
|
|
|
Posts:
3,815
Registered:
4-Aug-2006
|
|
|
Re: Preserving video metadata
Posted:
29 Oct 19, 22:44
in response to: sburke
|
|
|
|
Try the attached modified tool, it will work on each video except for IMG_0806ver2.mp4
I can update the tool itself, though it would need renaming as it does more than GPS data. Opinions?
|
|
|
Posts:
18
Registered:
18-Sep-2019
|
|
|
Re: Preserving video metadata
Posted:
30 Oct 19, 14:56
in response to: JeffTucker
|
|
|
Thanks jGromit.
Its a shame exiftool can't be used as an alternative metadata extractor - it seems to be capable of reading pretty much all the metadata you'd want.
|
|
|
Posts:
18
Registered:
18-Sep-2019
|
|
|
Re: Preserving video metadata
Posted:
30 Oct 19, 14:58
in response to: RobM
|
|
|
RobM - modified tool tested and does all I was hoping for! Can't tell you how much I appreciate this.
Edited by: sburke on 30-Oct-2019 14:58
|
|
|
|
Legend
|
|
Forum admins
|
|
Helpful Answer
|
|
Correct Answer
|
|