VideoHelp Forum




+ Reply to Thread
Results 1 to 7 of 7
  1. Member
    Join Date
    Nov 2006
    Location
    Australia
    Search Comp PM
    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?
    Quote Quote  
  2. Member
    Join Date
    Mar 2007
    Location
    Australia
    Search Comp PM
    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...
    Quote Quote  
  3. Member
    Join Date
    Dec 2004
    Location
    Australia
    Search Comp PM
    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).
    Quote Quote  
  4. Member
    Join Date
    Mar 2007
    Location
    Australia
    Search Comp PM
    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=1snr: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=2snr:bitrate=1000\

    Then how do i get my audio into aac and mux it all together?
    Quote Quote  
  5. Member
    Join Date
    Dec 2004
    Location
    Australia
    Search Comp PM
    You would need to encode the audio separately with I guess either 3gp enhaacenc or faac. You would need to run mplayer -ao pcm:fast first to decode. Then you need to use say mp4box to mux your raw video and audio to the final mp4.
    Quote Quote  
  6. Member
    Join Date
    Mar 2007
    Location
    Australia
    Search Comp PM
    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?
    Quote Quote  
  7. Member
    Join Date
    Dec 2004
    Location
    Australia
    Search Comp PM
    You could encode using crf (Quality-based VBR).
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!