[FFmpeg-user] batch script to process mp4
John Saturday
stozher at gmail.com
Wed Feb 22 21:21:07 CET 2012
> # Arguments:
> # "SourceFileDir" "TargetDir" "file.list"
Example (dot before first slash!):
./scriptname.sh /home/<user>/Videos/ /home/<user>/Videos/Output
"movie-01.mp4" "movie-02.mp4" ...
or simple
./scriptname.sh ~/Videos/ ~/Videos/Output "movie-01.mp4" "movie-02.mp4" ...
You need to create folder "Output" at "Videos" folder in my example.
If you go to "Videos" folder before starting script and script found
at this folder too:
cd ~/Videos
./scriptname.sh ./ ./Output "movie name.mp4"
Quotes used for folders and file names with spaces and other special symbols...
SCRIPT IS A BAD!!! - fixed change of volume, fixed bitrate and etc...
Just use command like this:
ffmpeg -vsync 2 -async 1 -i <input_video.mkv> -f mp4 -c:v libx264 -b:v
<bitrate> -r:v <frame per second> -c:a libfaac -b:a 128k
<output_video.mp4>
old variant of command line:
ffmpeg -vsync 2 -async 1 -i <input_video.mkv> -f mp4 -vcodec libx264
-b <bitrate> -r <frame per second> -acodec libfaac -ab 128k
<output_video.mp4>
bitrate=0.18*with*height*fps/1000 ->
0.18*704*480*(24/1.001)/1000=1458.36 -> 1458.36/40=36.46 ~ 37*40=1480k
(example for frame 704x480px at 24 frame per second)
frame per second: "24/1.001" for film, "25" for PAL, "30/1.001" for NTSC
"-b:a 128k" is for stereo, for 5+1 use 320k (or DVD standard 192k for
stereo and 448k for 5+1).
Please read FFMPEG manual and search at Wikipedia and Google for
standards... or install from repository video program like
http://handbrake.fr/
Good luck!
More information about the ffmpeg-user
mailing list