VideoHelp Forum
+ Reply to Thread
Results 1 to 13 of 13
Thread
  1. Member
    Join Date
    Oct 2014
    Location
    Astralogic
    Search PM
    Hi, I have a video I would like to convert (to lower it's quality, to make it easier to stream).

    I want to use x264 and I have the settings I believe will work.

    These are the setting I want to use:

    Audio Codec AAC
    Audio Bit Rate 128 Kbps
    Video Res 720x404
    Video Bit Rate 1275 Kbps
    Video Crf 23

    I have ffmeg installed, and the vfwx264 codec, so I think I'm ready to go. I'm just clueless about this command line stuff.

    Any help will be greatly appreciated.

    Thanks.
    Quote Quote  
  2. Try:
    Code:
    ffmpeg -i "input.whatever" -map 0:v:0 -map 0:a:0 -c:v libx264 -crf 23 -vf scale=w=720:h=480:force_original_aspect_ratio=decrease -c:a aac -ac 2 -b:a 128k "output.mp4"
    Notes:
    - ffmpeg doesn't need or otherwise use x264vfw
    - you either specifify a bitrate or crf, not both. ( https://trac.ffmpeg.org/wiki/Encode/H.264 )
    - resize to 720x480 max: https://trac.ffmpeg.org/wiki/Scaling%20(resizing)%20with%20ffmpeg
    (do you really need this low resolution? Most devides have no problems playing 1920x1080 or more.)
    - includes (down)mixing to stereo if needed https://trac.ffmpeg.org/wiki/AudioChannelManipulation
    - selects first video and audio stream: https://trac.ffmpeg.org/wiki/Map

    Often, most things work automatic with the ffmpeg defaults. Then something simple like this will suffice:
    Code:
    ffmpeg -i "input.whatever" "output.mp4"
    (ffmpeg's default codecs for .mp4 are H.264 and AAC. Default is first video and first audio. Default is crf 23. Default audio bitrate is 64k/channel)
    Quote Quote  
  3. You said you have ffmpeg "installed". How exactly? Simplest is if you add the path where "ffmpeg.exe" is residing into the Windows environment variable named %PATH%.

    See this tutorial on how to add to %PATH% and run the command in the folder you want to work in (usually where your input file is):
    http://adaptivesamples.com/how-to-install-ffmpeg-on-windows/
    Quote Quote  
  4. Member
    Join Date
    Oct 2014
    Location
    Astralogic
    Search PM
    My goal is to create a streamable version of the file, my wifi on my iphone and ipad seem to struggle keeping the audio in sync on HD videos.

    I am about to try your suggestions, I don't see why they wouldn't work

    Thanks
    Quote Quote  
  5. You probably also want to use the faststart option for online streaming:

    Code:
    -movflags faststart
    Quote Quote  
  6. Member
    Join Date
    Oct 2014
    Location
    Astralogic
    Search PM
    I'm going to do a test using just pure defaults, then I'll use the full comand line given here (adding -movflags faststart). Where in the command line do I add that? Can it go anywhere?
    Quote Quote  
  7. Member
    Join Date
    Oct 2014
    Location
    Astralogic
    Search PM
    -map 0:v:0 -map 0:a:0 -c:v libx264 -crf 23 -vf scale=w=720:h=480:force_original_aspect_ratio=decr ease -movflags faststart -c:a aac -ac 2 -b:a 128k
    Those are the parameters I used but I got an error:

    [libx264 @ 0000000002589f00] height not divisible by 2 (720x405)
    Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
    [aac @ 0000000000dc8820] Qavg: 65536.000
    [aac @ 0000000000dc8820] 2 frames left in the queue on closing
    The video source file is 1980x720.

    Does anyone know what's going wrong? I don't understand what ffmpeg thinks has a resolution of 720x405.
    Quote Quote  
  8. I believe the "force_original_aspect_ratio" is causing your requested 720x480 to change to 720x405 (16:9) -- you can't have odd (as in odd/even) frame sizes with most video codecs. I would even recommend multiples of 4 rather than multiples of 2. So just resize to 720x404 directly.

    1920x720 would be a very unusual frame size. Are you sure it's not 1280x720? That would be more consistent with the 16:9 aspect ratio with force_original_aspect_ratio.
    Quote Quote  
  9. Member
    Join Date
    Oct 2014
    Location
    Astralogic
    Search PM
    Originally Posted by jagabo View Post
    I believe the "force_original_aspect_ratio" is causing your requested 720x480 to change to 720x405 (16:9) -- you can't have odd (as in odd/even) frame sizes with most video codecs. I would even recommend multiples of 4 rather than multiples of 2. So just resize to 720x404 directly.

    1920x720 would be a very unusual frame size. Are you sure it's not 1280x720? That would be more consistent with the 16:9 aspect ratio with force_original_aspect_ratio.
    1280x720 is too high, it doesn't stream correctly for me, so I wanted go one step down but maintain the ratio witch I think is 720x480.

    So resizing to 720x404 direectly would be the same command line perameters, just without forcing the aspect ratio?
    Quote Quote  
  10. That's tricky, actually. I don't know if there is a way to tell force_original_aspect_ratio to use mod2. If it's not possible it is pretty useless unless maybe you crop a line away which is ugly.

    Using Google I found this:
    Code:
    scale=floor(iw*min(1\,min(720/iw\,480/ih))/2+0.4999999)*2:-2
    You can put "-movflags faststart" before the output filename.
    Quote Quote  
  11. Member
    Join Date
    Oct 2014
    Location
    Astralogic
    Search PM
    My command line looked like this:

    -map 0:v:0 -map 0:a:0 -c:v libx264 -crf 23 -vf scale=floor(iw*min(1\,min(720/iw\,480/ih))/2+0.4999999)*2:-2 -c:a aac -ac 2 -b:a 128k -movflags faststart
    But it gave me these errors:

    At line:1 char:135
    + ... :0 -map 0:a:0 -c:v libx264 -crf 23 -vf scale=floor(iw*min(1\,min(720/ ...
    + ~
    Missing argument in parameter list.
    At line:1 char:144
    + ... 0:a:0 -c:v libx264 -crf 23 -vf scale=floor(iw*min(1\,min(720/iw\,480/ ...
    + ~
    You must provide a value expression following the '/' operator.
    At line:1 char:144
    + ... :0 -c:v libx264 -crf 23 -vf scale=floor(iw*min(1\,min(720/iw\,480/ih) ...
    + ~~~
    Unexpected token 'iw\' in expression or statement.
    At line:1 char:144
    + ... 0:a:0 -c:v libx264 -crf 23 -vf scale=floor(iw*min(1\,min(720/iw\,480/ ...
    + ~
    Missing closing ')' in expression.
    At line:1 char:168
    + ... 3 -vf scale=floor(iw*min(1\,min(720/iw\,480/ih))/2+0.4999999)*2:-2 -c ...
    + ~
    Unexpected token ')' in expression or statement.
    + CategoryInfo : ParserError: ( [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : MissingArgument
    Quote Quote  
  12. Are you using PowerShell? You are probably not escaping the command correctly. (Probably easier to use cmd if you don't require PowerShell)
    Quote Quote  
  13. Member
    Join Date
    Oct 2014
    Location
    Astralogic
    Search PM
    Ah, yes I'm using powershell, I thought it was the same as cmd :/
    Quote Quote  



Similar Threads

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