I am confused with PyExifTool.
I did read the documentation at: 'https://sylikc.github.io/pyexiftool/examples.html#understanding-input-and-output-from-pyexiftool-base-methods'.
But I am too dense.
This script works from batch file:
exiftool -TagsFromFile _internal\360_metadata.mp4 "-all:all>all:all" output.mp4
Here is my unsuccessful attempt:
# Add 360 metadata to output.mp4 then delete utility files
def add_360_metadata(output_file):
global output_folder
# Construct full path to the source file
source_file = r"C:/Users/canjm/Desktop/STUFF/Test Area 20 - 360 D_F_EYE VID STITCHER/_internal/360_metadata.MP4"
target_file = os.path.join(output_folder, output_file)
# Copy all tags from source file to target file
with ExifToolHelper() as et:
et.set_tags(
[target_file], # Pass the target file only
tags={"-all:all>all:all": source_file}, # Use a dictionary with the correct format
params=["-P", "-TagsFromFile"]
)
Here was the error message:
File "C:\Users\canjm\AppData\Local\Programs\Python\Python312\Lib\site-packages\exiftool\helper.py", line 574, in _check_tag_list
raise ExifToolTagNameError(t)
exiftool.exceptions.ExifToolTagNameError: Invalid Tag Name found: "-all:all>all:all"
I was not successful in my effort to convert this code into Python code. Some assistance would be much appreciated.
PyExiftool isn't supported here, as it was created by a third party.
But the problem seems to be that -all:all>all:all is read as a single tag name, not as a copy operation. I don't know enough about PyExiftool or Python to be more helpful.
I think the problem might be that you're using et.set_tags because you are not doing a set tag operation, you are doing a tag copy operation.
I think you need to do an execute operation. These parameters need to be set in this order
"-TagsFromFile",source_file,"-All:All"
You don't need to use "-all:all>all:all". It's exactly the same as -All:All when placed after the -TagsFromFile (see this post (https://exiftool.org/forum/index.php?topic=14838.msg80002#msg80002)).