ffmpeg usage to encode a video to H264 codec format

后端 未结 5 1804
醉梦人生
醉梦人生 2021-01-30 06:42

I have a *.mp4 video file(MPEG4 video codec) and I am trying to convert this to a H264 video codec format(raw h.264 format) using ffmpeg on Linux(Version - FFmpeg version SVN-r0

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-30 07:07

    I have a Centos 5 system that I wasn't able to get this working on. So I built a new Fedora 17 system (actually a VM in VMware), and followed the steps at the ffmpeg site to build the latest and greatest ffmpeg.

    I took some shortcuts - I skipped all the yum erase commands, added freshrpms according to their instructions:

    wget http://ftp.freshrpms.net/pub/freshrpms/fedora/linux/9/freshrpms-release/freshrpms-release-1.1-1.fc.noarch.rpm
    rpm -ivh rpmfusion-free-release-stable.noarch.rpm
    

    Then I loaded the stuff that was already readily available:

    yum install lame libogg libtheora libvorbis lame-devel libtheora-devel
    

    Afterwards, I only built the following from scratch: libvpx vo-aacenc-0.1.2 x264 yasm-1.2.0 ffmpeg

    Then this command encoded with no problems (the audio was already in AAC, so I didn't recode it):

    ffmpeg -i input.mov -c:v libx264 -preset slow -crf 22 -c:a copy output.mp4
    

    The result looks just as good as the original to me, and is about 1/4 of the size!

提交回复
热议问题