c:
cd c:\ffmpeg\bin
ffmpeg -f dshow -video_size 320x240 -framerate 30 -pixel_format yuv420p -i video="Logitech HD Pro Webcam C910" -t 00:00:10 C:\ffmpeg\bin\video.mp4
ffmpeg -f dshow -i video="Logitech HD Pro Webcam C910" C:\ffmpeg\bin\picture1.jpeg
ffmpeg -f dshow -i video="Logitech HD Pro Webcam C910" C:\ffmpeg\bin\picture2.jpeg
move C:\ffmpeg\bin\picture1.jpeg C:\Users\Owner\Desktop\TestFolder
move C:\ffmpeg\bin\picture2.jpeg C:\Users\Owner\Desktop\TestFolder
move C:\ffmpeg\bin\video.mp4 C:\Users\Owner\Desktop\TestFolder
ren C:\Users\Owner\Desktop\TestFolder\picture1.jpeg Picture-%date:~4,2%-%date:~7,2%-%date:~10,4%_%time:~0,2%h%time:~3,2%m%time:~6,2%s%.jpeg
ren C:\Users\Owner\Desktop\TestFolder\picture2.jpeg Picture-%date:~4,2%-%date:~7,2%-%date:~10,4%_%time:~0,2%h%time:~3,2%m%time:~6,2%s%.jpeg
ren C:\Users\Owner\Desktop\TestFolder\video.mp4 Video-%date:~4,2%-%date:~7,2%-%date:~10,4%_%time:~0,2%h%time:~3,2%m%time:~6,2%s%.mp4
taskkill /im ffmpeg.exe /t /f
I've created a batch file that will take a ten second video and two screenshots from my webcam. My batch file works correctly until I try to rename the files. I don't understand why it is not working because I've used this code on another computer before and just copied, pasted it, and adjusted the file names around so it would work for my purposes. Any help would be greatly appreciated.
Related
I'm trying to write a batch file that can be launched from Handbrake GUI with the "send file to" feature, that will split an MKV into chapters with MKVmerge, then convert all those new files into mp4s with ffmpeg. Handbrake passes only one argument into the batch file, the full file path of the output (surrounded by quotes). I'm very new to batch scripting and am having difficulty getting it all to work together -- all the individual parts work just fine when absolute paths are given. Here's the content of the .bat file:
START /WAIT "C:\Program Files\MKVToolNix\mkvmerge.exe -o output.mkv --split chapters:all %1"
for %%i in (*.mkv) do C:\ffmpeg\bin\ffmpeg.exe -i "%%i" -loop 1 -i "%%~dpi"\folder.jpg -map 1:v -map 0:a -c:a ac3 -b:a 640K -pix_fmt yuv420p -c:v libx264 -shortest -fflags +shortest -max_interleave_delta 100M "%%~ni.mp4"
Any glaring mistakes I'm making? I've been at this for hours reading SO threads and documentation, and can't figure it out for the life of me. Any help is appreciated, thanks in advance.
How do I write a .bat file in Windows 10 that changes the frame rate for multiple mp4 video clips in a folder? For example; change the frame rate from 50fps to 25fps (without re-encoding or dropping frames, so that footage is essentially slowed down.)
At the moment these are the commands I've tried using in two separate .bat text files. (I'd like to combine them but don't know how yet).
for %%A IN (*.mp4) DO ffmpeg -y -i "%%A" -c copy -f h264 "%%A.h264"
for %%A IN (*.h264) DO ffmpeg -y -r 25 -i "%%A" -c copy
"%%A_25.mp4"
Problem is these commands don't replace the file extension type, they append to the existing one, ie. '.mp4' becomes '.mp4.h264' then '.mp4.h264_25fps.mp4', and I can't get the second one to work for some reason.
Any advice appreciated. How do I replace the existing file extensions for a group of clips and combine commands into a single .bat?
I have over 700 files that I need to take a screenshot at a specific time. I have been doing this one by one, but it is very time consuming. How could I do this with an ffmpeg batch file?
I also need the output of the file to be named the same as the video input.
I've been using this command:
ffmpeg -ss 00:03:45 -i "input.Mp4" -vframes 1 -q:v 2 "output.jpg"
Use this as batch file
for %%i in (*.mp4) do ffmpeg -ss 00:03:45 -i "%%i" -vframes 1 -q:v 2 "%%~ni.jpg"
i have a folder full of .avi files and i want to use ffmpeg to convert them to .mp4 files. I followed an online tutorial to create a batch file that does just this, here is the code:
"C:\ffmpeg\ffmpeg.exe" -y -i %1 -sameq -ar 22050 -vcodec libx264 "C:\videos\Series 1\S01E01.mp4"
This works fine if i just drag and drop the .avi files onto the createmp4.bat file containing the above code. However i want to be a little bit smarter about this and use another batch file that will iterate through the .avi files in the folder and run createmp4.bat on all of them and copy them to the C:\videos\Series 1\ directory.
I would also like to change the name of the files if possible to S01E01.mp4, S01E02.mp4 and so on if possible.
Any help on this would be greatly appreciated. Oh and just in case you hadn't guessed i am fairly clueless about writing batch files!!
Thanks
try this (example):
#echo off & setlocal
pushd "X:\My AVI folder"
for %%i in (*.avi) do "C:\ffmpeg\ffmpeg.exe" -y -i "%%~fi" -sameq -ar 22050 -vcodec libx264 "C:\videos\Series 1\%%~ni.mp4"
popd
I've made a batch file for drag and drop conversion of video using ffmpeg.
I'm using avisynth script "avs" as input.
The generated video is "my video file.avs.mp4"
How can i make the generated video filename to be "my video file.mp4" ?
here is my batch:
#echo off
title Converting video for mobile phone... by xXx
ffmpeg.exe -y -i %1 -f mp4 -vcodec libxvid -b 150k -r 25 -maxrate 150k -bt 1k -bufsize 4M -acodec libfaac -ac 1 -ab 32 -ar 22050 -vol 20 -aspect 4:3 %1.mp4
title Finished!!! Press any key to close the window
echo.
echo.
echo.
echo "Success... press any key to close the window."
pause > nul
Thanks in advance!
I suppose your param %1 contains "my video file.avs"
Then this should work
ren "%~1.mp4" "%~n1.mp4"