FFMPEG put creation time in output file name? - ffmpeg

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)

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.

how do i combine txt file from a list of file emplacement

i have a problem, i used "everything" to extract every txt file from a specific directory so that i can merge them. But on emeditor i don't find a way to merge file from a list of localisation.
Here what the everything file look like:
E:\Main directory\subdirectory 1\file.txt
E:\Main directory\subdirectory 2\file.txt
E:\Main directory\subdirectory 3\file.txt
E:\Main directory\subdirectory 4\file.txt
The list goes over 40k location. is there a way to use a program to read all the location in the text file and combine them ?
Also, the subdirectory has other txt file that i don't want to so i can't just merge all txt file from the main. Another thing is that there are variation of the "file.txt" like "Files.txt" for example.

Shell Script to Convert CSV to Text File

I need to create a shell script that reads a different folder based on today's date and inside the folder contains multiple files and one csv file that will have unique name everyday that is tab delimited. I want to pull this file and resave it as a text file.
Example of file path:
data/model/output20190725 (folder contains multiple files, new folder is created everyday)
-logfile1
-logfile2
-part3983isis4838.csv (this csv file will have a new and randomly generated name everyday, the csv file is also tab delimited)
I know how to go from a csv file to a text file, but I don't know how to add the logic of the folder name and the csv name changing everyday.
I saw that I could possibly use grep, but I don't know how to navigate to today's date folder and pull the csv and pass to the next argument to make the conversion.
grep -l .csv * |

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.

Is there an ffmpeg flag to not ask for overwrite but add a number at the end?

I have a script that converts ~8000 files to mp3. I have some files that have a sielar name, where just the extension is diffrent, and they would create all the same .mp3 file with my script at the moment.
So I just want ffmpeg to add something like (x) at the end of the name befor the extension and not ask me every few files.
Thank you!
The flag for overwrite without asking y/n is ( -y ), just include -y in your command.
(-y overwrites files of same name without asking).
Look at ffmpeg docs: https://ffmpeg.org/ffmpeg.html.
To find this flag just search for "overwrite" key word in the docs.
Example to extract an image from video and save it without asking y/n.
ffmpeg -i <video_file_here> -y -ss 00:00:00 -vframes 1 image.jpg)
Now to save file name with a new number each time you can make a bat file with a loop counter variable and increase the number and issue the command with the new number each time.
for a reference on how to do this, you can check one of my questions here. incrementing a counter variable inside a FORLOOP
FFmpeg does not have the functionality you describe.
You need to implement it in your script instead.
Or (on the FFmpeg command line) explicitly specify such output file name that is guaranteed not to exist.
For example, if all your input files are in the same directory, then for an input file named fname.ext use output file named fname.ext.mp3 and place it in a new directory.

Resources