Render all video in folder with ffmpeg?

  • I have a folder containing a lot of 2-10 min videos ….(30 video in folder)
  • How to process multiple videos in a folder and cut videos into small videos 55s.
  1. This is the line of code to process the entire folder containing videos

@ECHO OFF
Setlocal EnableDelayedExpansion
set INPUT=C:\Users\ABC\Desktop\in
set OUTPUT=C:\Users\ABC\Desktop\out
: encode video
for %%a in ("%INPUT%*.mp4") DO ffmpeg -i "%%a" -vcodec libx264 -pix_fmt yuv420p -g 60 -r 30 -b:v 1000k -acodec libmp3lame -b:a 128k -ar 48000 -metadata title="" -metadata artist="" -metadata album_artist="" -metadata album="" -metadata date="" -metadata track="" -metadata genre="" -metadata publisher="" -metadata encoded_by="" -metadata copyright="" -metadata composer="" -metadata performer="" -metadata TIT1="" -metadata TIT3="" -metadata disc="" -metadata TKEY="" -metadata TBPM="" -metadata language="eng" -metadata encoder="" -preset superfast "%OUTPUT%/%%~na.mp4"

  1. This is the code to cut 55s video

ffmpeg -i 11.mp4 -filter_complex "crop=ih*(9/16):ih" -crf 21 -c:a copy -f segment -segment_time 55 -reset_timestamps 1 -preset ultrafast chep49_%03d.mp4

  1. Error command to process multiple Video Files using batch file

Render all video in folder with ffmpeg?
====>>> The question is how to combine the above 2 sentences into 1
====>>> Can you help me please?

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

See if it is this that you want:

Render all video in folder with ffmpeg?

@ECHO OFF
Setlocal EnableDelayedExpansion
set INPUT=C:\users\ABC\Desktop\in
set OUTPUT=C:\users\ABC\desktop\out

:: encode video:

for %%a in ("%INPUT%\*.*") DO ffmpeg -i "%%a" -vcodec libx264 -pix_fmt yuv420p -g 60 -r 30 -b:v 1000k -acodec libmp3lame -b:a 128k -ar 48000 -metadata title="" -metadata artist="" -metadata album_artist="" -metadata album="" -metadata date="" -metadata track="" -metadata genre="" -metadata publisher="" -metadata encoded_by="" -metadata copyright="" -metadata composer="" -metadata performer="" -metadata TIT1="" -metadata TIT3="" -metadata disc="" -metadata TKEY="" -metadata TBPM="" -metadata language="eng" -metadata encoder="" -preset superfast -filter_complex "crop=ih*(9/16):ih" -crf 21 -c:a copy -f segment -segment_time 55 -reset_timestamps 1 -preset ultrafast "%output%\%%~na_%%03d.mp4"

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply