Find all video files in directory with FLAC audio codec - cmd

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.

Related

Running OpenFace tool on multiple video files via command line

I have downloaded the OpenFace tool for facial landmark extraction. Following the wiki, I am able to extract features of a single video file by running the following on a windows command line interface
./FeatureExtraction.exe -f "...\CREMA-D\VideoFlash\1001_DFA_ANG_XX.flv" -out_dir ".../openface-output" where -f represents the path of my input file.
However, I would like to extract ALL the .flv videos in the ...\CREMA-D\VideoFlash directory at once. Is there an easy way to do this?
Edit:
It is possible to add multiple -f flags e.g. ./FeatureExtraction.exe -f "...\CREMA-D\VideoFlash\1001_DFA_ANG_XX.flv" -f "...\CREMA-D\VideoFlash\1002_DFA_ANG_XX.flv" -f "...\CREMA-D\VideoFlash\1003_DFA_ANG_XX.flv" -out_dir ".../openface-output". Is there a way to perhaps loop through all the possible files and add this flag using a FOR DO loop?
Or potentially do a for loop of ./FeatureExtraction.exe -f "...\CREMA-D\VideoFlash\[file].flv" -out_dir ".../openface-output" for each file in a particular directory
My current hackish solution is to start a for loop and iterate through each file in the input location FOR %i IN ("...\CREMA-D\VideoFlash\*") DO .\FeatureExtraction.exe -f %i -out_dir "...\crema-d\openface-output"

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)

Script to bulk merge audio and a video+audio file

I have a folder with 52 video+audio files (m3u8 extn)
and 52 audio files (different language)(m4a extn)
The names of the files are same
abcde.m3u8(video)
abcde.m4a(that other language audio only file)
i want to merge them so i have a single file Video+auido1+audio2
and i don't to lose any quality in the merging process
What would be the bash/ffmpeg command to do so?
Thanks a lot
Something like :
for f in *.m3u8
do
basename="${f%.*}"
ffmpeg -i "${basename}.m3u8" -i "${basename}.m4a" -c copy "${basename}.mkv"
done
Are you sure the m3u8 files contain actual video frames?

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

Batch copy metadata from one file to another (EXIFTOOL)

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.

Resources