Problems while tagging Blackvue videos

Started by JLI, June 14, 2021, 06:48:49 AM

Previous topic - Next topic

JLI

Hello,

I'm using ExifTool to add GPS tags to Blackvue dashcam video files which can be read by other software (like google photos).

This is the command for adding the gps tags, and when it works, it works fine:
$exiftool_A = 'exiftool -overwrite_original -ee -tagsfromfile '.$temp_path.' -GPSAltitudeRef="0" -Keys:make="Blackvue" -Keys:Model="DR750S-2CH" -XMP-tiff:ImageDescription="Desc XXX" '.$temp_path.'';
$exiftool_B = 'exiftool -overwrite_original -c \'%.5f\' -ee -tagsfromfile '.$temp_path.' \'-Keys:GPSCoordinates<$GPSLatitude $GPSLatitudeRef, $GPSLongitude $GPSLongitudeRef, $GPSAltitude\' '.$temp_path.'';


It works fine for some files, but the majority of them fails with something similar to this:
Warning: Truncated '\xafY^r' data - 20210613_020535_TF.mp4
Error: '\xafY^r' atom is too large for rewriting (3188 MB) - 20210613_020535_TF.mp4
    0 image files updated
    1 files weren't updated due to errors


When executing "exiftool -v3" on the files, this is shown at the end:
...
  | | | | |     [snip 11124 bytes]
  Unknown_xafYr
  - Tag '\xafY^r' at offset 0xb8da71c (3342905162 bytes)
  Warning = Truncated '\xafY^r' data


The video file is only 187MB in size, so something must be wrong here.
It's not a corrupted file, on my Blackvue DR750-2CH this happens for >99% of the files.

Here you can download two example video files (front and back) from Google Photos (original quality) which both show the same issue:
https://photos.app.goo.gl/HiaDrsyC6fesC31M8


Is this a bug or am I doing something wrong here?


Thanks in advance!  :D

JLI

Luuk2005

Greetings JLI, the only related post that Im finding was this one... https://exiftool.org/forum/index.php?topic=10673.0
Its from an old version, so then Harvey fixes his problem with an update, to let -m conduct it as a warning, instead of an error.
But since exiftool presents 'error:' and not 'warning:', maybe your trouble comes from something else besides bad atom size ????

Its unfortunate, but I cannot find the .mp4 to conduct any experiments, even with trying to enable the javascript.
Im also tried to "View Page Source", but still cannot find the url for this .mp4 file, so hoping someone else can advise.
Windows8.1-64bit,  exiftool-v12.92(standalone),  sed-v4.0.7

JLI

Quote from: Luuk2005 on June 14, 2021, 09:29:10 AM
Greetings JLI, the only related post that Im finding was this one... https://exiftool.org/forum/index.php?topic=10673.0
Its from an old version, so then Harvey fixes his problem with an update, to let -m conduct it as a warning, instead of an error.
But since exiftool presents 'error:' and not 'warning:', maybe your trouble comes from something else besides bad atom size ????

Its unfortunate, but I cannot find the .mp4 to conduct any experiments, even with trying to enable the javascript.
Im also tried to "View Page Source", but still cannot find the url for this .mp4 file, so hoping someone else can advise.

Hey, thanks for your answer! I've uploaded the two video files to my own server. You should be able to download them easier now:
https://jlinsi.de/20210613_074029_NF.mp4
https://jlinsi.de/20210613_073223_NR.mp4

I've already saw that post, but the error doesn't change, event when using the "-m" argument.


Best Regards

JLI

Luuk2005

Since the exiftool presents error, Im thinking that Phil Harvey will need to study these files, so its good that you have direct links now.
Im just started the download for myself, so it should complete in 47 minutes, but its very unlikely I can discover anything extra.
Hopefully, it can be something like the other post, that never affects video data, so then maybe an update could ignore it.
Windows8.1-64bit,  exiftool-v12.92(standalone),  sed-v4.0.7

Phil Harvey

Quote from: JLI on June 14, 2021, 05:53:59 PM
I've already saw that post, but the error doesn't change, event when using the "-m" argument.

What version of ExifTool are you using?

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

JLI

Quote from: Phil Harvey on June 15, 2021, 08:50:01 AM
Quote from: JLI on June 14, 2021, 05:53:59 PM
I've already saw that post, but the error doesn't change, event when using the "-m" argument.

What version of ExifTool are you using?

- Phil

Hey, I'm using Exiftool Version 12.26 12.27 on Ubuntu 20.04.2.

edit: just updated, no change.

JLI

Quote from: Phil Harvey on June 15, 2021, 08:50:01 AM
Quote from: JLI on June 14, 2021, 05:53:59 PM
I've already saw that post, but the error doesn't change, event when using the "-m" argument.

What version of ExifTool are you using?

- Phil

Hey, is there anything I can try or do you need anything else to maybe find the error?

Thanks!

Phil Harvey

OK.  I've taken a look at one of the files you uploaded.

This is a bit of a tricky situation.  The file contains a trailer that doesn't conform to the MP4 specification, so it appears to be corrupted as far as ExifTool is concerned.  ExifTool errs on the side of safety, and the usual strategy is to avoid writing corrupted files to prevent causing further damage.  There was a patch in a previous release to allow small trailers like this to be ignored, but this trailer is rather large (> 2 MB), so there is potentially a lot of information in there that could/would get lost if ExifTool attempted to rewrite the file.

I'm not really sure what is best to do here.  For the small unknown trailers, ExifTool just deletes them when the file is rewritten.  For larger trailers I hesitate to do this.  The reason the trailer is deleted rather than preserved is due to the fact that it may contain offsets into the file that would be invalidated when the file is edited.

One possible solution is for you to remove these trailers yourself if they don't contain any information that is useful to you.  You could perhaps do this with a utility like ffmpeg.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

StarGeek

Quote from: Phil Harvey on June 21, 2021, 08:16:59 AM
One possible solution is for you to remove these trailers yourself if they don't contain any information that is useful to you.  You could perhaps do this with a utility like ffmpeg.

But doing so would also lose the embedded GPS track and Accelerometer data.  Luckily, there isn't an EXIF block as that would also be lost.

Otherwise, I believe that this would be the ffmpeg command to use.  It will copy all streams and all metadata that ffmpeg knows about.  It could be followed up with an exiftool command to copy all the data that exiftool can copy.  The above mentioned data will still be lost.
ffmpeg -i input.mp4 -map_metadata 0 -c copy -map 0 out.mp4
followed by
exiftool -TagsFromFile input.mp4 -all:all out.mp4

And I have to say that Copyright is a damn strange place to save a bunch of camera data/settings.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

JLI

Thank you both!

Yeah, I experimented with adding a additional step in which ffmpeg would strip of this trailer.

I came up with something similar to:
Quote from: StarGeek on June 21, 2021, 11:44:54 AM
ffmpeg -i input.mp4 -map_metadata 0 -c copy -map 0 out.mp4

While it does work in sense of adding gps data with Exiftool afterwards, the file is only 184MB instead of 192MB in size and the native Blackvue Viewer won't show any GPS data.
(ffmpeg shows this: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x4cb990] Found duplicated MOOV Atom. Skipped it)

Google photos however can read the GPSCoordinates tag and adds the little map under infos. Awesome!

While this is fine for what I initially wanted to do, I'd really love to keep that additional trailing data in case I need to have a look at the gps speeds/positions at some point.

I'll continue to experiment with it... if I ever find a solution, I'll make sure to post it here. Suggestions are welcome!

Quote from: StarGeek on June 21, 2021, 11:44:54 AM
And I have to say that Copyright is a damn strange place to save a bunch of camera data/settings.

Yeah, I don't get it either. Pittasoft's software is really shady if you look twice. Part of their cloud platform was operating without any passcodes or encryption at some point. You only had to know a users mail address to request data xD I'd love to switch to another manufacturer, but being able to automatically copy all video files via wifi to google photos once it logs into my home network is kinda cool.


Best regards

Julian

StarGeek

Quote from: JLI on June 22, 2021, 09:45:21 AM
Google photos however can read the GPSCoordinates tag and adds the little map under infos. Awesome!

While this is fine for what I initially wanted to do, I'd really love to keep that additional trailing data in case I need to have a look at the gps speeds/positions at some point.

I'll continue to experiment with it... if I ever find a solution, I'll make sure to post it here. Suggestions are welcome!

Yeah, that's the type of problem I've been thinking about for quite a while.  I've pretty much decided on keeping the original files and making copies for anything else.  Right now I'm playing with an AI upscaling program for some of my really old, really small videos.  And I figure things are just going to get better along these lines, so might as well keep the originals.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

JLI

Quote from: StarGeek on June 22, 2021, 11:51:58 AM
Yeah, that's the type of problem I've been thinking about for quite a while.  I've pretty much decided on keeping the original files and making copies for anything else.  Right now I'm playing with an AI upscaling program for some of my really old, really small videos.  And I figure things are just going to get better along these lines, so might as well keep the originals.

Totally. That's what I should do, but as I don't really want to pile up a bunch of raw video files locally, I'll probably auto-upload the edited version from now on. I'll try removing the trailing data manually and adding it after exiftool is done. But first I have to figure out how to analyse such big files. :)