I found this thread about batch processing ffmpeg for stabilizing the videos. But I had some questions, but the forum suggested makign a new thread instead of posting in the old one. So here it is.
How does this work? How do I specify which folder my mp4 files to be stabilized are?
and if we go with selur's suggestion, will the code look like below?
Code:SET PATH="E:\Backup\Video Apps\Video Encoders\FFmpeg\FFMpeg\64-bit" for %%a in ("*.mov") do ffmpeg -i %%a -vf vidstabdetect=shakiness=10:accuracy=15:result="%%~na.trf":show=1 -an -f null NUL for %%a in ("*.mov") do ffmpeg -i %%a -vf vidstabtransform=crop=black:input="%%~na.trf" -c:v libx264 -level 41 -pix_fmt yuv420p -g 24 -crf 19 -c:a aac -strict experimental -ar 48000 -ab 256k -f mp4 "%%~na_stab.mp4" pause
if I wanted to stabilize a bunch of mp4s, then will the code look like
How will the resulting files be neamed? Same as the original? But won't that overwrite the original? Or will it prompt the replace or keep eveyrtime it converts a file?Code:SET PATH="E:\Backup\Video Apps\Video Encoders\FFmpeg\FFMpeg\64-bit" for %%a in ("*.mp4") do ffmpeg -i %%a -vf vidstabdetect=shakiness=10:accuracy=15:result="%%~na.trf":show=1 -an -f null NUL for %%a in ("*.mp4") do ffmpeg -i %%a -vf vidstabtransform=crop=black:input="%%~na.trf" -c:v libx264 -level 41 -pix_fmt yuv420p -g 24 -crf 19 -c:a aac -strict experimental -ar 48000 -ab 256k -f mp4 "%%~na_stab.mp4" pause
I need some help please.
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 10 of 10
Thread
-
-
The way that is written, you place the .bat file in the same folder of files to be converted, then double click to execute . All .mov files will be processed in the folder. The output files will be placed in the same directory, with same filenames but "_stab" appended at the end of filename and mp4 container. Original files will not be overwritten as they have different filename and extension. But some people like to use other directories or better yet drives (faster to read/write to different physical drives, and safer)
If you wanted to specify a different directory, you can add it to the end instead of
Code:"%%~na_stab.mp4"
Code:"PATH\%%~na_stab.mp4"
-
Thank you for the reply. It makes sense now. I'm off to test this out. I'll be back if my laptop doesn't blow up. Wish me luck!
-
Ok. I've tried it out with the following code.
Code:SET PATH="C:\ffmpeg\bin" for %%a in ("*.mp4") do ffmpeg -i %%a -vf vidstabdetect=shakiness=10:accuracy=15:result="%%~na.trf":show=1 -an -f null NUL for %%a in ("*.mp4") do ffmpeg -i %%a -vf vidstabtransform=crop=black:input="%%~na.trf" -c:v libx264 -level 41 -pix_fmt yuv420p -g 24 -crf 19 -c:a aac -strict experimental -ar 48000 -ab 256k -f mp4 "C:\temp\%%~na_st.mp4" pause
And it's giving me error because of the white spaces. I can rename all the file, but is there a way to script that in there?
Also how will I strip the metadata from the file as the stabilization ends? I found this code from superuserhttps://superuser.com/questions/441361/strip-metadata-from-all-formats-with-ffmpeg
Where thwy suggested the following
Code:ffmpeg -i in.mov -map_metadata -1 -c:v copy -c:a copy out.mov
Code:SET PATH="C:\ffmpeg\bin" for %%a in ("*.mp4") do ffmpeg -i %%a -vf vidstabdetect=shakiness=10:accuracy=15:result="%%~na.trf":show=1 -an -f null NUL for %%a in ("*.mp4") do ffmpeg -i %%a -vf vidstabtransform=crop=black:input="%%~na.trf" -c:v libx264 -level 41 -pix_fmt yuv420p -g 24 -crf 19 -c:a aac -strict experimental -ar 48000 -ab 256k -f mp4 "C:\temp\%%~na_st.mp4" for %%a in ("*.mp4") do ffmpeg -i %%a -map_metadata -1 -c:v copy -c:a copy %%~na_st.mp4 pause
-
put the input %%a in quotation marks
Code:SET PATH="C:\ffmpeg\bin" for %%a in ("*.mp4") do ffmpeg -i "%%a" -vf vidstabdetect=shakiness=10:accuracy=15:result="%%~na.trf":show=1 -an -f null NUL for %%a in ("*.mp4") do ffmpeg -i "%%a" -vf vidstabtransform=crop=black:input="%%~na.trf" -c:v libx264 -level 41 -pix_fmt yuv420p -g 24 -crf 19 -c:a aac -strict experimental -ar 48000 -ab 256k -f mp4 "C:\temp\%%~na_st.mp4" pause
which metadata are you referring to exactly ? -
Ah ok. " %%a" it is then.
by metadata, I mean title, author, comment, encoder, and date etc. I'd like strip them all of private information. Since the file aklready has the title, no other information is needed for me.
And it seems the ffmpeg stabilization results in much bigger file that I would normally get from within virtual dub. Has anyone noticed this? -
When you re-encode, all those values will be overwritten anyways. But ffmpeg can only access some of the fields, not all. Some other ones might be accessible by exiftool. MetaX (not free) is another for MP4 container. You don't "save" any filesize by stripping metadata (it's negligible), most people don't bother .
And it seems the ffmpeg stabilization results in much bigger file that I would normally get from within virtual dub. Has anyone noticed this? -
if I can bother you with more question related to this...
i think I prefer VD's shaker than this ffmpeg version, and i was wondering if you have a way to process mutiple mp4 files ina folder using batch process in virtualdub.
I think job control and other functions in virtualdub can be helpful, but I just can't figure out.
I did manage to batch produce avs files in a folder for each mp4s i want to process. It's to direct show the mp4's in virtual dub instead of having to convert them to avi files.
Now I just need a way to use the same setting on the deshaker filter and run video analysis, deshake, and then export as mp4s using external encoder.
I was trying to setup windows macro programs to do it, but I'm not having much luck in that dept either.
Can you suggest something to accomplish what I am trying to do here? -
I've never used deshaker in batch, but there are some posts about it
eg.
https://forum.videohelp.com/threads/311345-mass-deshaker-script
http://sleepytom.co.uk/virtualdubbatch
http://tipzorro.blogspot.ca/2015/06/virtualdub-and-deshaker-in-batch-mode.html
Similar Threads
-
Need help with batch processing Avidemux for OS X
By SetoTitan in forum Newbie / General discussionsReplies: 1Last Post: 11th Feb 2017, 15:24 -
Tsmuxer Batch Processing
By ron spencer in forum Video ConversionReplies: 2Last Post: 20th Apr 2016, 18:01 -
[BATCH PROCESSING] how to replace CHOOSE.EXE in a batch routine?
By marcorocchini in forum Newbie / General discussionsReplies: 3Last Post: 10th Nov 2015, 03:33 -
Batch processing of audio
By BobAchgill in forum AudioReplies: 1Last Post: 2nd Apr 2015, 14:36 -
Batch processing in Avidemux 2.6
By tokintmash in forum Video ConversionReplies: 1Last Post: 21st Jan 2015, 04:24