Multiple files with one ffmpeg command?

Everything about displays and monitors. 120Hz, 144Hz, 240Hz, 4K, 1440p, input lag, display shopping, monitor purchase decisions, compare, versus, debate, and more. Questions? Just ask!
Xx123456xX
Posts: 33
Joined: 03 Dec 2016, 16:03
Location: Houston, TX

Multiple files with one ffmpeg command?

Post by Xx123456xX » 07 Aug 2017, 09:10

I have 109 videos in two folders. One contains 1-78, the other contains 79-109. They are all 24fps videos with names a1-a109. I want to convert them to 120fps videos b1-b109.

I want to use the following command on all of them:
ffmpeg -i a.mov -r 120 -vf "setpts=(1/5)*PTS" -an b.mov

Is there an alternative command which effectively gives this command to multiple inputs, or will I have to type the "normal" command 109 times?

User avatar
RealNC
Site Admin
Posts: 3739
Joined: 24 Dec 2013, 18:32
Contact:

Re: Multiple files with one ffmpeg command?

Post by RealNC » 07 Aug 2017, 13:51

You can script it. For example with this command:

Code: Select all

for i in {1..78}; do ffmpeg -i a$i.mov -r 120 -vf "setpts=(1/5)*PTS" -an b$i.mov; done
This will run ffmpeg 78 times, for each aN.mov file, and produce a bN.mov output, where N goes from 1 to 78.

(This assumes you're on Linux or Mac OS. This won't work on Windows.)
SteamGitHubStack Overflow
The views and opinions expressed in my posts are my own and do not necessarily reflect the official policy or position of Blur Busters.

Xx123456xX
Posts: 33
Joined: 03 Dec 2016, 16:03
Location: Houston, TX

Re: Multiple files with one ffmpeg command?

Post by Xx123456xX » 07 Aug 2017, 14:16

I'm on Windows, so unfortunately this won't work.
Thanks for trying to help though.

User avatar
RealNC
Site Admin
Posts: 3739
Joined: 24 Dec 2013, 18:32
Contact:

Re: Multiple files with one ffmpeg command?

Post by RealNC » 07 Aug 2017, 14:33

Didn't test it, but on Windows you should be able to do:

Code: Select all

for /l %x in (1, 1, 78) do ffmpeg -i a%x.mov -r 120 -vf "setpts=(1/5)*PTS" -an b%x.mov
SteamGitHubStack Overflow
The views and opinions expressed in my posts are my own and do not necessarily reflect the official policy or position of Blur Busters.

Xx123456xX
Posts: 33
Joined: 03 Dec 2016, 16:03
Location: Houston, TX

Re: Multiple files with one ffmpeg command?

Post by Xx123456xX » 07 Aug 2017, 15:13

I tried this and got the following error message:
At line:1 char:4
+ for /l %x in (1, 1, 78) do ffmpeg -i a%x.mov -r 120 -vf "setpts=(1/5) ...
+ ~
Missing opening '(' after keyword 'for'.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorID : MissingOpenParenthesisAfterKeyword

User avatar
RealNC
Site Admin
Posts: 3739
Joined: 24 Dec 2013, 18:32
Contact:

Re: Multiple files with one ffmpeg command?

Post by RealNC » 07 Aug 2017, 16:30

Well, I don't know what's wrong. I just tested on Windows 10 and it works fine.
SteamGitHubStack Overflow
The views and opinions expressed in my posts are my own and do not necessarily reflect the official policy or position of Blur Busters.

User avatar
Chief Blur Buster
Site Admin
Posts: 11647
Joined: 05 Dec 2013, 15:44
Location: Toronto / Hamilton, Ontario, Canada
Contact:

Re: Multiple files with one ffmpeg command?

Post by Chief Blur Buster » 07 Aug 2017, 18:02

What's your ffmpeg version?

Some older versions have missing options.

Also, sometimes batch files handles things differently from command lines (such as different parsing of % or paranthesis characters), you may wish to doublecheck. RealNC, are you pasting into a command line, or pasting into a batch file?
Head of Blur Busters - BlurBusters.com | TestUFO.com | Follow @BlurBusters on Twitter

Image
Forum Rules wrote:  1. Rule #1: Be Nice. This is published forum rule #1. Even To Newbies & People You Disagree With!
  2. Please report rule violations If you see a post that violates forum rules, then report the post.
  3. ALWAYS respect indie testers here. See how indies are bootstrapping Blur Busters research!

Xx123456xX
Posts: 33
Joined: 03 Dec 2016, 16:03
Location: Houston, TX

Re: Multiple files with one ffmpeg command?

Post by Xx123456xX » 07 Aug 2017, 18:23

When typing:
ffmpeg -version

it says:
ffmpeg version N-82966-g6993bb4 Copyright (c) 2000-2016 the FFmpeg developers

User avatar
RealNC
Site Admin
Posts: 3739
Joined: 24 Dec 2013, 18:32
Contact:

Re: Multiple files with one ffmpeg command?

Post by RealNC » 07 Aug 2017, 18:23

I just typed it in directly in the command line. No need to make batch files for one-off uses.
SteamGitHubStack Overflow
The views and opinions expressed in my posts are my own and do not necessarily reflect the official policy or position of Blur Busters.

User avatar
Chief Blur Buster
Site Admin
Posts: 11647
Joined: 05 Dec 2013, 15:44
Location: Toronto / Hamilton, Ontario, Canada
Contact:

Re: Multiple files with one ffmpeg command?

Post by Chief Blur Buster » 07 Aug 2017, 18:40

True. But what someone is doing with a command line, someone else might be pasting into a batch file unbeknownst to you..

Usually it works, but weird character parsing has caught that off guard sometimes...

Let's see what OP says.
Head of Blur Busters - BlurBusters.com | TestUFO.com | Follow @BlurBusters on Twitter

Image
Forum Rules wrote:  1. Rule #1: Be Nice. This is published forum rule #1. Even To Newbies & People You Disagree With!
  2. Please report rule violations If you see a post that violates forum rules, then report the post.
  3. ALWAYS respect indie testers here. See how indies are bootstrapping Blur Busters research!

Post Reply