Author Topic: Excluding tags in tagsFromFile not working  (Read 659 times)

regystro

  • Newbie
  • *
  • Posts: 3
Excluding tags in tagsFromFile not working
« on: April 30, 2019, 07:54:37 AM »
Hi.

I'm trying to copy some tags from test.mov to test.mp4 which is just a conversion from test.mov using ffmpeg.

The mov has 4 tracks: Video, Audio and 2 extra (maybe geolocation... I dunno / don't care)
The mp4 also has 4 tracks (full streams copy)

Code: [Select]
exiftool -tagsFromFile test.mov -MediaCreateDate test.mp4
Error: Can't locate data reference to update offsets for Track3 - test.mp4

I know that must be some unsupported offset / tag in destination file, that's why I want to explicitly exclude it from tagsFromFile:

I want to avoid exiftool to copy all Track3 tags, but this doesn't work, even forcing the tag group:
Code: [Select]
exiftool -g1 -tagsFromFile test.mov -x Track3:* -Track1:MediaCreateDate>Track1:MediaCreateDate test.mp4
Error: Can't locate data reference to update offsets for Track3 - test.mp4

Shouldn't exiftool skip any references to track3 using that command-line?

Since this works for reading:
Code: [Select]
exiftool -a -s -g1 --Track3:* -MediaCreateDate test.mov
Code: [Select]
---- Track1 ----
MediaCreateDate                 : 2019:04:24 13:06:42
---- Track2 ----
MediaCreateDate                 : 2019:04:24 13:06:42
---- Track4 ----
MediaCreateDate                 : 2019:04:24 13:06:42

Been trying a lot of options, even -unsafe, etc... It's driving me nuts.

Please help!!!

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16658
    • ExifTool Home Page
Re: Excluding tags in tagsFromFile not working
« Reply #1 on: April 30, 2019, 09:24:35 AM »
ExifTool only has limited write ability for MOV files.

But with an error like this:

Code: [Select]
Error: Can't locate data reference to update offsets for Track3
I don't think that ExifTool will write the file at all.

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

regystro

  • Newbie
  • *
  • Posts: 3
Re: Excluding tags in tagsFromFile not working
« Reply #2 on: May 02, 2019, 08:48:27 AM »
But I'm not trying to write to a mov file, but from mov to mp4 instead.

It works well if I previously remove Track3 from test.mp4 with ffmpeg, but I was wondering if ExifTool could bypass / exclude tags by family group, since it works for reading. I mean -g1 option is ignored when using -tagsFromFile I guess.

Thank you for your response.



Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16658
    • ExifTool Home Page
Re: Excluding tags in tagsFromFile not working
« Reply #3 on: May 02, 2019, 09:42:59 AM »
If there is an error in the track3 structure, then ExifTool will not write the file.  If you want to send it to me, I can take a look (philharvey66 at gmail.com)

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

regystro

  • Newbie
  • *
  • Posts: 3
Re: Excluding tags in tagsFromFile not working
« Reply #4 on: May 06, 2019, 05:08:24 AM »
I think I found where the problem is. This is ffprobe's output of the original mov, created with an iPad Air:

Code: [Select]
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'original.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 0
    compatible_brands: qt
    creation_time   : 2019-04-24T13:13:19.000000Z
    com.apple.quicktime.make: Apple
    com.apple.quicktime.model: iPad Air
    com.apple.quicktime.software: 12.2
    com.apple.quicktime.creationdate: 2019-04-24T15:13:18+0200
  Duration: 00:00:44.24, start: 0.000000, bitrate: 17110 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 17038 kb/s, 26.06 fps, 29.97 tbr, 600 tbn, 1200 tbc (default)
    Metadata:
      creation_time   : 2019-04-24T13:13:19.000000Z
      handler_name    : Core Media Data Handler
      encoder         : H.264
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 63 kb/s (default)
    Metadata:
      creation_time   : 2019-04-24T13:13:19.000000Z
      handler_name    : Core Media Data Handler
    Stream #0:2(und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
    Metadata:
      creation_time   : 2019-04-24T13:13:19.000000Z
      handler_name    : Core Media Data Handler
    Stream #0:3(und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
    Metadata:
      creation_time   : 2019-04-24T13:13:19.000000Z
      handler_name    : Core Media Data Handler
Unsupported codec with id 0 for input stream 2
Unsupported codec with id 0 for input stream 3

Check 2 last lines.

Code: [Select]
exiftool "-MediaCreateDate=2019:01:01 00:00:00" "original.mov" works as expected without problems.

If I transcode it or even copy streams like this:
Code: [Select]
ffmpeg -i original.mov -map 0 -codec copy test.mov... ffmpeg output says:
Code: [Select]
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
  Stream #0:2 -> #0:2 (copy)
  Stream #0:3 -> #0:3 (copy)
[mov @ 000001eab9858020] Unknown hldr_type for mebx, writing dummy values

and then, this fails:
Code: [Select]
exiftool "-MediaCreateDate=2019:01:01 00:00:00" "test.mov"
Error: Can't locate data reference to update offsets for Track3 - test.mov
    0 image files updated
    1 files weren't updated due to errors

If you want to have a look, here you are original2s.mov.  That's original.mov trimmed to 2 seconds (ffmpeg -i original.mov -t 2 -map 0 -codec copy original2s.mov). I don't know why ffmpeg makes it not suitable for exiftool. I have a lot of movs transcoded to mp4 this way... all with scrambled metadata due to ffmpeg I guess. That's why I hoped it would be great if we could skip some tags / tracks when using -tagsFromFile.

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16658
    • ExifTool Home Page
Re: Excluding tags in tagsFromFile not working
« Reply #5 on: May 06, 2019, 07:52:17 AM »
Thanks for the sample.  I'll take a close look at this when I get a chance, but from the ffmpeg messages it does seem as if the metadata was messed up.  For fear of making things worse, Exiftool errs in the side of safety and won't rewrite a file if there are significant problems.  I'll take a look at this, but it does seem the safe thing to do in this case.

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