[FFmpeg-user] Convert to H.264

Tom Evans tevans.uk at googlemail.com
Thu Dec 13 18:06:18 CET 2012


On Thu, Dec 13, 2012 at 4:33 PM, Josu Lazkano <josu.lazkano at gmail.com> wrote:
> Hello all, I am trying to convert a video file to H.264 and AAC. This
> is the source video format:
>
> # mediainfo summer.avi
> General
> Complete name                            : summer.avi
> Format                                   : AVI
> Format/Info                              : Audio Video Interleave
> File size                                : 641 MiB
> Duration                                 : 50mn 43s
> Overall bit rate                         : 1 766 Kbps
> Writing application                      : VirtualDubMod 1.5.10.2
> (build 2540/release)
> Writing library                          : VirtualDubMod build 2540/release
>
> Video
> ID                                       : 0
> Format                                   : MPEG-4 Visual
> Format profile                           : Advanced Simple at L5
> Format settings, BVOP                    : 2
> Format settings, QPel                    : No
> Format settings, GMC                     : No warppoints
> Format settings, Matrix                  : Default (H.263)
> Codec ID                                 : XVID
> Codec ID/Hint                            : XviD
> Duration                                 : 50mn 43s
> Bit rate                                 : 1 628 Kbps
> Width                                    : 704 pixels
> Height                                   : 528 pixels
> Display aspect ratio                     : 4:3
> Frame rate                               : 25.000 fps
> Color space                              : YUV
> Chroma subsampling                       : 4:2:0
> Bit depth                                : 8 bits
> Scan type                                : Progressive
> Compression mode                         : Lossy
> Bits/(Pixel*Frame)                       : 0.175
> Stream size                              : 591 MiB (92%)
> Writing library                          : XviD 1.2.1 (UTC 2008-12-04)
>
> Audio
> ID                                       : 1
> Format                                   : MPEG Audio
> Format version                           : Version 1
> Format profile                           : Layer 3
> Mode                                     : Joint stereo
> Codec ID                                 : 55
> Codec ID/Hint                            : MP3
> Duration                                 : 50mn 43s
> Bit rate mode                            : Constant
> Bit rate                                 : 128 Kbps
> Channel(s)                               : 2 channels
> Sampling rate                            : 48.0 KHz
> Compression mode                         : Lossy
> Stream size                              : 46.4 MiB (7%)
> Alignment                                : Aligned on interleaves
> Interleave, duration                     : 40 ms (1.00 video frame)
> Interleave, preload duration             : 504 ms
>
>
> I read that I need "libx264" vcodec, but I want to get same aspect
> ratio and I don't know which parameters use.

You could have tried some things first. Maybe looked at the manual, or
at appropriate google search results. Anyhow..

>
> I want H.264 to play with VDPAU profile, could you help with the command?
>

First off, why do you want to convert it? Re-encoding a lossy encoder
with another lossy encoder will not normally give great results.

You cannot use VDPAU to accelerate ffmpeg. VDPAU is a framework for
playback decoding, so is of no use during encoding, and because of
it's presentation path, it is tricky/impossible to use it to decode
frames to then use as a source in ffmpeg - the frames are in the
graphics card at that point*.

ffmpeg would also preserve things like aspect ratio anyway, so the
command line is simple:

ffmpeg - i yourfile.avi -c:a copy -c:v libx264 -crf 18 out.mp4

crf stands for 'constant rate factor' and controls the quality of the
output, increase crf to decrease the quality (and probably lower
bitrate). You can also add '-preset veryslow' to get slightly lower
bitrate for the same quality, or '-preset veryfast' to get a higher
encoding speed, but with also higher bitrate.

Cheers

Tom


* As I understand i anyway - the explanation may be wrong, but you
cannot use VDPAU to accelerate encoding.


More information about the ffmpeg-user mailing list