Not sure that this is the right forum but seems the most appropriate. Forgive me if it's not...
I've got a whole bunch of files of different codecs, resolutions, qualities and containers that i want to convert to .mp4 with the video encoded in H.264, i'm trying to write a generic script to do it. See i have a mate with an SGI (or whatever it is but it's grunty) who'll happily do it for me just so long as i write a script rather than him having to do it all himself... Apparantly this SGI will rip through at around 20x even to H.264.
The way i figure it a shell script is my best option and either ffmpeg or mencoder but i really have no idea after that.
In sudo code i want to:
For each video file in the configured folder:
Identify the resolution of this file, aspect ratio, and quality if possible
call ffmpeg/mencoder tell it i want x264 and the resolution, aspect ration & quality specified and a .mp4 container
My problems are:
1. Should i use mencoder or ffmpeg, for that decision i would want to know if either has an option that will cause the output file to have the same resolution/aspect ratio as the input file?
2. If the answer to one is neither has such an option how will i identify what the current file's resolution is?
3. What is the command i would issue to convert say movie1 being a avi to an x264.mp4 of the right resolution/aspect ratio with a fixed quantizer(spell?)?
4. How do i write all of this into a script?
The thought occurs that surely I'm not the first person to want to do this but i can't find any scripts anyone else has done...
Thanks so much in advance.
Oh and what audio codec should i use?
+ Reply to Thread
Results 1 to 7 of 7
-
-
I've had a little progress:
I've found that 'mplayer -identify movie.avi' will display the information i need (resolution etc)which i should be able to grep (haven't tried yet). Trouble is that plays the file as well, i can't seem to figure out how to just identify the file without playing it... -
Yeah, it didn't used to play it. Think the general consensus was to use -frames 0 -vc null -vo null, etc. or something to that effect. Should be more info on the mailing list.
By default both will give you the same resolution as the input though. With mencoder you will need to output raw video, then remux using say mp4box. Where as ffmpeg can output mp4 directly (including audio encoded by faac or lame). -
Ok
i get so far as
for i in *.avi *.mpg blah blah
do
done
i'm aiming to do two passes on the video, but how do i go about this, do i rip the audio then rip the video? How do i do that?
I think i'm pretty safe with the two part encoding being something like:
mencoder $i temp -ovc x264 -x264encopts subq=4:bframes=3:b_pyramid:weight_b:turbo=1ass=1
snr:bitrate=1000
then for the second pass:
mencoder $i temp -ovc x264 -x264encopts subq=6:4x4mv:8x8dct:me=3:frameref=5:bframes=3:b_py ramid:weight_bass=2
snr:bitrate=1000\
Then how do i get my audio into aac and mux it all together? -
Ok,
I've actually found a script which i plan to leverage: http://forum.doom9.org/showthread.php?p=958891
The thing with this script as i see it is it assumes a bitrate of 800 is appropriate, which it would be if everything i'm encoding were 640x480 or bigger but unfortunately it isn't, some things are much smaller and there really isn't a need for such a large bitrate on those files.
Is there a way to say use the bitrate most appropriate? ie a constant quality factor?
Similar Threads
-
Convert h.264 MP4 to DVD
By matthewjohn23 in forum Authoring (DVD)Replies: 15Last Post: 12th Jul 2014, 23:00 -
Convert AVI (miniDV) to MKV/MP4, large files only convert partially
By Video Eddie in forum Video ConversionReplies: 0Last Post: 3rd Jan 2011, 05:44 -
How to convert an h.264 MKV with softsubs to an h.264 MP4 with hardsubs.
By hawk16zz in forum User guidesReplies: 4Last Post: 27th Apr 2010, 11:41 -
Script to convert MTS to MP4 losslessly?
By isoelectricpoint in forum Video ConversionReplies: 4Last Post: 3rd Jul 2009, 13:23 -
What is the best program to convert from H.264 mp4 to H.264 avi?
By Stealth3si in forum Video ConversionReplies: 6Last Post: 15th Sep 2007, 10:11