Batch copy metadata from one file to another (EXIFTOOL) - windows

Im currently using tags such as exiftool -FileModifyDate(<)datetimeoriginal, etc. in terminal/cmd...
Im switching from icloud and the dates in the metadata are exif (meaning finder and windows explorer just see the date they were downloaded)..
It's working but for any sloMo videos that are M4V, they dont change.. I have the originals which do have the right dates and was wondering if there is a way to match file names (123.mp4 = 123.m4v) and copy the metadata over... But I also want to do it in batches. (since every month I will be offloading my iphone every month or so) Thanks!

It will depend upon your directory structure, but your command should be something like this:
exiftool -TagsFromFile %d%f.mp4 "-FileModifyDate<datetimeoriginal" -ext m4v DIR
This assumes the m4v files are in the same directory as the mp4 files. If not, change the %d to the directory path to the mp4 files.
Breakdown:
-TagsFromFile: Instructs exiftool that it will be copying tags from one file to another.
%d%f.mp4: This is the source file for the copy. %d is a exiftool variable for the directory of the current m4v file being processed. %f is the filename of the current m4v file being processed, not including the extension. The thing to remember is that you are processing m4v files that are in DIR and this arguments tells exiftool how to find the source mp4 file for the tag copy. A common mistake is to think that exiftool is finding the source files (mp4 in this case) to copy to the target files (m4v) when exiftool is doing the reverse.
"-FileModifyDate<datetimeoriginal": The tag copy operation you want to do. Copies the DateTimeOriginal tag in the file to the system FileModifyDate.
-ext m4v: Process only m4v files.
Replace DIR with the filenames/directory paths you want to process. Add -r to recurse into sub-directories. If this command is run under Unix/Mac, reverse any double/single quotes to avoid bash interpretation.

Related

Find all video files in directory with FLAC audio codec

Is it possible to search a directory and output a text file listing every video file that has FLAC audio?
My television doesn't support FLAC so when I run into one I have been converting them with a FFMPEG script but it would be nice to be able to find them all in advance instead of waiting until I hit the problem while trying to play the files. I'm hoping there is a way that doesn't involve just opening every file in Mediainfo and checking manually.
Maybe there is a way to just output all of the Mediainfo information for a directory and then I can just find all FLAC occurrences in a csv sheet?
You can open all files in MediaInfo then export to CSV then open the CSV in a spreadsheet processor, or for a smaller output you can customize the output with the command line version of MediaInfo (see the download section on the MediaInfo website and download the CLI version) and a template file template.txt containing:
General;%CompleteName%,
Audio;%Format%
Audio_Middle;,
File_End;\n
and this command line:
mediainfo --Output=file://template.txt --ParseSpeed=0 YourDir > List.txt
List.txt will contain a CSV file with complete file name in first column, then audio format per track (2nd column has 1st audio format, 3rd column has 2nd audio format...)
--Output=file://template.txt selects the template file.
--ParseSpeed=0 reduces the parsing speed (no need of the extra info from a longer parsing).
YourDir is to be replaced by the directory name you want to scan.
> List.txt sends the output to a file.

FFMPEG put creation time in output file name?

I'm currently combining a bunch of video files together, and was wondering if I could just add the creation timestamp from the first video file to the output file name?
So the file list would be
file-2022.02.23~17:39:29.flv
file-2022.02.23~18:23:22.flv
file-2022.02.23~18:55:43.flv
file-2022.02.23~21:56:10.flv
and the converted output name would be
file_%timestamp%.mp4
Where %timestamp% is the creation time of the first file (file-2022.02.23~17:39:29.flv)

Batch Convert Files Different Output Folder

Goal is to convert all .wav files to .mp3 in a different location.
The following code works, but creates output files in the same directory.
All the newly created .mp3's are right alongside the .wav's.
for file in /path/to/*.wav; do lame --preset insane "$file" "${file%.wav}".mp3; done
How can I use terminal to convert a drive full of .wav's with lame and output the .mp3's to a different drive? I've tried changing lame's output, but this syntax grabs the entire filename. Looking for the most simple solution.
From the lame manual, the synopsis is very straightforward:
lame [options] <infile> <outfile>
Found the basic concept here
Assuming that the output files should be placed to /output, possible to extend loop to calculate the output file name using the 'basename'
OUT=/output
for file in /path/to/*.wav; do
# Replace .wav with .mp3
out=${file%.wav}.mp3
# Remove directory (anything up to the last '/'
out=${file##*/}
lame --preset insane "$file" $OUT/$out
done

Bulk duplicate files in different directories

Sorry I am not sure if I ask in the right place. I have a problem on metadata.
Folder0
 ├ Folder1
 │  ├ Folder1.png
 │  └ Other files
 ├ Folder2
 │  ├ Folder2.png
 │  └ Other files
 └ Folder3
    ├ Folder3.png
    └ Other files
To
Folder0
 ├ Folder1
 │  ├ Folder1.png
 │  ├ Cover.png
 │  └ Other files
 ├ Folder2
 │  ├ Folder2.png
 │  ├ Cover.png
 │  └ Other files
 └ Folder3
    ├ Folder3.png
    ├ Cover.png
    └ Other files
Is it possible to run a command line or if any software can help me duplicates the *.png in different subfolders to another png and rename it to Cover.png? Will be the best to ignore if Cover.png exists.
That will save me a lot of time since I have over 2000 folders like this.
Thanks for the help.
This can be done using Exiftool using this command
exiftool -r -ext png -o . -Filename=%d/cover.png /path/to/directories/
Exiftool will recursively read all the directories looking for PNG files. When it encounters one, it will create a copy named cover.png. If the cover.png already exists, exiftool will display 1 files weren't updated due to errors but will continue. If there are multiple PNG files, only the first one it reads will be copied and the others will return the above error.
Breakdown:
-r (recurse) option - Recurse through subdirectories
-ext png - Process only PNG files
-o. - Set the output file or directory name. When using the Filename tag (next option in the command), this causes the file to be copied instead of recreated in the output directory. The dot is used as a dummy argument in this cases because the use of the Filename tag overrides the output directory used here
-Filename=%d/cover.png - This will be the name used by the previous -o option. The %d is the directory of the file that is being processed (copied), which completes the target path to the new cover.png file.
/path/to/directories/ - replace this with the path to the top level of the directory tree you want to process. If you have CDed into the top directory, use a dot . to represent the current directory.

Find duplicate audio files via meta-tags?

I had Banshee's meta-data fixer handle all the meta-data inconsistency, now does anyone know some command line fu to search recursively through a directory and find duplicate files based on similar meta-data in regard to song title, artist name and finally, print a list of the file names of the duplicates?
I'm trying to remove many redundant audio files and I've found a program called dupeGuru to be somewhat helpful, but I'd like to simply print out a list of the duplicate filenames like:
/home/username/Music/song.mp3
/home/username/Music/oldItunes/song.wma
and then finally redirect this output to a file.
You can try exiftool.
To get comment tag of all *.{jpg,png} files in /path/to/dir/:
$ exiftool -r -ext .jpg -ext .png -comment /path/to/dir/

Resources