Hi, and i'm a cat
and even though.
---
I try to do a batch file that concatenate using ffmpeg all the .mp4 in a directory, but first have to analize all the files parsed to verify is all the files have:
the same resolution
the same framerate
the same codec
the rotation flag
At the moment I have build this code that simply concatenate all the .mp4 except for the final concatenated one (using fart.exe to delete the output file from the list of files to be concatenated)
supposing in a folder are present 120.mp4 121.mp4 122.mp4 123.mp4, the batch have to concatenate all in one unique conCAT.MP4.Code:@Echo Off color 6 if exist concatList.txt del concatList.txt setlocal for %%f in (*.mp4) do echo file '%cd%\%mypath%%%f' >> "concatList.txt" fart.exe concatList.txt "file '%cd%\conCAT.MP4'" --remove endlocal ffmpeg64bit_2019.exe -y -threads 12 -y -f concat -safe 0 -i concatList.txt -map 0:? -ignore_unknown -vcodec copy -acodec copy -aspect 16:9 conCAT.MP4 if exist concatList.txt del concatList.txt exit
In this case, for example, concatlist.txt become
But only if they have the same resolution the same framerate the same codec the rotation flag... if they are identical. How can I do thanksCode:file 'C:\Users\Administrator\Desktop\Loris\120.mp4' file 'C:\Users\Administrator\Desktop\Loris\121.mp4' file 'C:\Users\Administrator\Desktop\Loris\122.mp4' file 'C:\Users\Administrator\Desktop\Loris\123.MP4'
?
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 8 of 8
Thread
-
-
You can use MediaInfo to get this info:
Code:MediaInfo.exe file.mp4 > file.txt
PS: this can help https://stackoverflow.com/questions/41231998/mediainfo-cli-command-line-interface-synt...e-once-for-allLast edited by CDK; 31st Jul 2022 at 08:31.
-
an idea to start would be
:
Code:@Echo Off color 6 if exist concatList.txt del concatList.txt if exist %cd%\conCAT.MP4 del %cd%\conCAT.MP4 setlocal for %%f in (*.mp4) do echo file '%cd%\%mypath%%%f' >> "concatList.txt" fart.exe concatList.txt "file '%cd%\conCAT.MP4'" --remove for /f "delims=" %%F in ('dir *.MP4 /b /o-n') do set FirstFile="%cd%\%%F" echo 1st file is %FirstFile% pause mediainfo.exe %FirstFile% dumpinfo:unicodefile.txt TYPE unicodefile.txt>mediainfo.txt rem ********* IF exist unicodefile.txt DEL unicodefile.txt IF exist mediainfo.txt DEL mediainfo.txt endlocal ffmpeg64bit_2019.exe -y -threads 12 -y -f concat -safe 0 -i concatList.txt -map 0:? -ignore_unknown -vcodec copy -acodec copy -aspect 16:9 conCAT.MP4 if exist concatList.txt del concatList.txt exit
%FirstFile% assume 120.mp4 as first file.
Mediainfo should parse %FirstFile% and store resolution, framerate, rotation and codec info and compare the info with all other .mp4 to verify if all the .mp4 files are concatenable
If the files do not have the same characteristics, the batch returns an error and exits. If they are similar it continues in the concatenation process.
Really it would be perhaps interesting that if the batch finds a rotated file (for example by 90 °) it is first remuxed as straight and then concatenated, but this is already another question)
I -
#24 input and further there are some subroutines that you can use:
https://forum.videohelp.com/threads/377677-Video-batch-files
but for all kids out there, if deciding to make some codes to automatize processes, do not do this using microsoft batch code, use python instead -
interesting batch, even if at the moment I don't seem to find something that exactly compares the metadata of several files one with the others. In practice it would be a question of comparing if the resolution-framerate-idcodec-rotation of all the files present in a folder are exatly the same. If anyone wants to help the cat
-
you have a subroutine that gives you w, h, fps (add codec and rotation) of the first file, save them to different variables
then run that subroutine for each file and if file does not have the same values as those in first file, do not add them in the list -
thanks but a litte complicated for a cat-brain
however I would like to do another thing, if someone helps me: we still consider the original batch. When I run the batch inside a folder that contains some .mp4 files it generate a final file called concat.txt which contains the names of the individual .mp4 files. But now I need to generate also a concat.txt of the only file drag and dropped to the batch. In this case how should I modify the batch?
Similar Threads
-
Use ffmpeg to batch screenshots of many video files
By MC23 in forum Newbie / General discussionsReplies: 4Last Post: 11th May 2020, 01:57 -
How to join batch video files?
By iKron in forum Video ConversionReplies: 7Last Post: 9th Sep 2018, 13:19 -
batch to verify the video level of a image
By marcorocchini in forum Newbie / General discussionsReplies: 1Last Post: 9th Jul 2018, 17:19 -
batch that verify if a VFW codec is installed and "usable" by Windows?
By marcorocchini in forum Newbie / General discussionsReplies: 2Last Post: 19th Jun 2018, 22:27 -
Video batch files.
By pcspeak in forum Video ConversionReplies: 62Last Post: 14th Feb 2018, 20:24