I want to batch convert a directory containing hundreds of FLV files so that each file has a MP4 equivalent. I'm trying to automate this process by writing a shell script and running it from the Terminal. How do I go about doing that? Most of the instructions available are for Linux using ffmpeg but I think OS X doesn't have it. Thanks.
views:
46answers:
3
+2
A:
You can install ffmpeg via MacPorts. The command to install ffmpeg is sudo port install ffmpeg
. Once you've installed ffmpeg, here is a simple (and somewhat naive) script for converting the files. You may need to throw in some additional flags, depending on your desired output options.
#! /bin/bash
function convert_all_to_mp4(){
for file in *.flv ; do
local bname=`basename "$file" .flv`
local mp4name="$bname.mp4"
ffmpeg -i "$file" "$mp4name"
done
}
convert_all_to_mp4
Michael Aaron Safyan
2010-08-20 05:13:25
This code has great potential. Will try it out. I can imagine so many uses for it other than this task. Thanks. ;-)
GeneQ
2010-08-20 06:33:01
+1
A:
#!/bin/bash
shopt -s nullglob
shopt -s nocaseglob
for file in *.flv
do
ffmpeg -i "$file" "${file%flv}mp4"
done
ghostdog74
2010-08-20 05:23:23
A:
you can do it with VLC
http://wiki.videolan.org/Transcode#Transcoding_with_the_Command_Prompt
Aaron Saunders
2010-08-20 05:58:08