Can I change Make & Model without concern

Started by worx, November 15, 2020, 04:02:41 PM

Previous topic - Next topic

StarGeek

That is probably an actual problem with the file structure.  I can only find one other time it's been mentioned here and that person never followed up. 

Phil will have to comment on this.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

worx

#16
I did some more testing and it seems as if the problem sits with the mp4 files themselves. The mp4s I have been testing with are from the new Pixel 4a 5G and looking at what was written about metadata and video files I suspect Google devs have broken/changed something.

To give some details - I can get the info out for i.e. 

exiftool PXL_20201203_110732369.mp4

but can't make changes to the i.e. CreateDate or Make or any of the custom Tags I use for all the other files.

Phil Harvey

Quote from: worx on December 02, 2020, 04:04:14 PM
Error: No data reference for sample description 0 for Track1 - PXL_20201120_163528123.mp4

I downloaded a Pixel 4a sample and it looks like I have some work to do here.  These videos use a new format that I haven't seen yet for the sample entries in the sample table box.  It looks like this may be allowed by the specification, but it also looks like it may be a real pain to deal with.

- 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 ($).

worx


Phil Harvey

[This is more for my reference than anything else...]

After studying the specification more closely I am convinced that the Pixel 4 writes the sample table box incorrectly.  According to the specification, each SampleEntry must begin with 6 zero bytes followed by a 2-byte data_reference_index.  I found the specification for the 'mett' sample entry used by the Pixel 4, and it extends the basic SampleEntry thus (from the ISO_IEC_14496-12 specification):

aligned(8) abstract class SampleEntry (unsigned int(32) format)
   extends Box(format){
   const unsigned int(8)[6] reserved = 0;
   unsigned int(16) data_reference_index;
}
class MetaDataSampleEntry(codingname) extends SampleEntry (codingname) {
   Box[] other_boxes; // optional
}
class TextMetaDataSampleEntry() extends MetaDataSampleEntry ('mett') {
   string   content_encoding; // optional
   string   mime_format;
   BitRateBox ();    // optional
   TextConfigBox (); // optional
}


Therefore, each 'mett' MetadataSampleEntry must still begin with 6 zero bytes and a 2-byte data_reference_index.  However, the Pixel 4 skips this and jumps straight to the content_encoding string, which is clearly wrong:

  | | | | + [SampleTable directory]
  | | | | | MetaSampleDesc (SubDirectory) -->
  | | | | | - Tag 'stsd' (50 bytes):
  | | | | |  1f4b07a: 00 00 00 00 00 00 00 01 00 00 00 2a 6d 65 74 74 [...........*mett]
  | | | | |  1f4b08a: 61 70 70 6c 69 63 61 74 69 6f 6e 2f 6d 65 74 61 [application/meta]
  | | | | |  1f4b09a: 00 61 70 70 6c 69 63 61 74 69 6f 6e 2f 6d 65 74 [.application/met]
  | | | | |  1f4b0aa: 61 00                                           [a.]


(The first SampleEntry starts immediately after the 'mett' identifier in the above exiftool -v3 output from a Pixel 4 video.)

Since the data_reference_index is needed to be able to rewrite the file properly, ExifTool can't edit these files without risk of further damage.  Google will have to fix this at their end.

- 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 ($).

worx


worx

I have another question:

I am using this command
exiftool '-createdate<${filename;$_=/(\d+)/ ? $1 : undef} 00:00:00' -if '$SynologyPhotoTagOther eq "WhatsApp"' -ext jpg -ext jpeg /volume1/'photo uploads'/automation/sortingFolder to rename WhatsApp files:
=> Input: 'IMG-20201201-WA0001.jpg'
=> Output: '2020.12.01-00.00.00-1-WhatsApp' (if there are two files)

I would like to improve this command, if it is simple enough to maintain. At the moment this command sets the HH:MM:SS to '00:00:00' on every file. What I would like it to do is use the numbering after the 'WA' i.e. 0001 in this example IMG-20201201-WA0001.jpg as the MM:SS. I would like the output to look like this sample:
=> Output: '2020.12.01-00.00.01-WhatsApp'

Is this easily achievable? Thanks

Phil Harvey

This won't work the way you are thinking. What happens if the number is WA0060?

- 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 ($).

worx

The day I will get 60 pictures in via WhatsApp will be a sad day  ;D

I get your point though that this isn't an easy one to implement and far from essential.

Thanks for the feedback Phil,

Phil Harvey

OK, try this:

exiftool '-createdate<${filename;$_=/(\d{8}).*(\d{4})/ ? "$1 00:$2" : undef}' -if '$SynologyPhotoTagOther eq "WhatsApp"' -ext jpg -ext jpeg DIR

This will do what you wanted when writing CreateDate.  But I'm a bit confused.  Are you talking now about changing the FileName?  Your example implies this, but unless I missed something you didn't mention this.

- 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 ($).