-1

I have a basic command to convert mov files to mp4; I'd like to be able to convert a folder of videos from mov to mp4. I want it to take the filename of from the .mov file and use that for the filename for the .mp4. How can I do this?

ffmpeg -i video1.mov -r 60 -c:v libx264 -b:v 70000k -c:a aac -b:a 192k -movflags faststart video2.mp4

Windows 10

JK81
  • 45
  • 6
  • 1
    What operating system are you using? – Tom Aranda Nov 07 '17 at 02:40
  • See answer by lxs in link above. – llogan Nov 07 '17 at 03:45
  • Hi, I read that thread and am not sure if I should run this command as a .bat file. Here's what I adapted from that thread. How do I run this? Command prompt? I'm on Windows 10. `FOR /F "tokens=*" %G IN ('dir /b *.mov') DO ffmpeg -i "%G" -map_metadata -1 -c:v libx264 -b:v 70000k -c:a aac -b:a 192k -movflags faststart "%~nG .mp4"` – JK81 Nov 07 '17 at 13:38
  • Ok, so I ran the command from the cmd prompt and it works. However, I want to have a command that specifuies a source folder, I tried: `FOR /F "tokens=*" %G IN ('dir 60fps /b *.mov') DO ffmpeg -i "%G" -r 60 -map_metadata -1 -c:v libx264 -b:v copy -c:a aac -b:a copy -movflags faststart "%~nG .mp4"` and it doesn't work. – JK81 Nov 07 '17 at 14:42
  • As the first comment to the answer states you need to, "double the `%` signs => `%%`" for usage in a .bat file. I suggest making a comment on the answer regarding the source folder as I don't use Windows. – llogan Nov 07 '17 at 20:09

1 Answers1

0

i might be wrong, but i don't think ffmpeg can do that by itself. however, it is trivial to do with several popular scripting languages, for example php:

<?php
declare(strict_types = 1);
if ($argc !== 2) {
    fprintf ( STDERR, "usage: %s dir\n", $argv [0] );
    die ( 1 );
}
$dir = rtrim ( $argv [1], DIRECTORY_SEPARATOR );
if (! is_readable ( $dir )) {
    die ( "supplied path is not readable! (try running as an administrator?)" );
}
if (! is_dir ( $dir )) {
    die ( "supplied path is not a directory!" );
}
$files = glob ( $dir . DIRECTORY_SEPARATOR . '*.mov' );
foreach ( $files as $file ) {
    system ( "ffmpeg -i " . escapeshellarg ( $file ) . ' ' . escapeshellarg ( $file . '.mp4' ) );
}
hanshenrik
  • 15,263
  • 3
  • 28
  • 61
  • Any other way to just run from Windows? – JK81 Nov 07 '17 at 03:05
  • @JK81 yes, in windows you can use [batch scripting](https://en.wikipedia.org/wiki/Batch_file) or [Powershell scripting](https://technet.microsoft.com/en-us/library/hh551144.aspx) , however i haven't done batch scripting for many years, nor do i know of anyone else who have, and i much prefer php scripting to batch scripting, and i have used both extensively. i've never learned powershell scripting though. – hanshenrik Nov 07 '17 at 10:17
  • also, [php is fully windows compatible](http://windows.php.net/download/) – hanshenrik Nov 07 '17 at 10:23