How to achieve a fast encoding speed from H.265 to H.264 using FFmpeg?

10,202

There isn't much you can do with your displayed command, but here are some "suggestions":

  • Stream copy (re-mux) the audio instead of re-encoding it by changing -c:a aac to -c:a copy.

  • See if a hardware accelerated encoder such as h264_nvenc instead of libx264 is faster.

  • Also check if a hardware decoder is faster.

  • Add -movflags +faststart output option. This will actually increase the process time by an insignificant amount (compared with the total time), but will let the video begin faster for the viewer.

  • Scale the video to half size with the output option -vf scale=iw/2:-2

  • And the obligatory obnoxiously obvious statement: use a faster CPU or encode on multiple machines.

  • Keep it as H.265 and only support Android, Edge, and Safari. Not a terrible solution if you're already providing VP9 (Webm). Then only Internet Explorer will be missing out.

Share:
10,202

Related videos on Youtube

Natiebiscuit
Author by

Natiebiscuit

Updated on September 18, 2022

Comments

  • Natiebiscuit
    Natiebiscuit almost 2 years

    So I'm pretty new to video encoding and I'm currently using FFmpeg to change the encoding of a video from H.265 to H.264 so it's suitable for the web.

    The current syntax of the command I'm running is

    ffmpeg -i input.mp4 -c:v libx264 -crf 51 -preset ultrafast -c:a aac output.mp4 
    

    I'm currently just trying to get this encoding to run as fast as possible and I'm not sure if there's any additional flags or settings I can tweak to make it run faster.

    I've also tried setting the zerolatency and fastdecode tune to see how that affects it but that didn't do much in terms of speed.

    As far as I know, setting the crf value and an ultrafast preset are basically my options for speeding up the encoding, but are there any additional flags or settings I can use to help speed it up?

  • erik
    erik over 2 years
    "Keep it as H.265 and only support Android, Edge, and Safari" caniuse.com/hevc pretty much no one supports h265