Search code examples
ffmpegmp4video-processingwebmh.265

Most time effective web format for converting h.265


So, I configured my ipcams to send event videos to a FTP server that saves it locally, and run a script that convert every video into something that can be opened in a generic browser, then send it to a S3 (I am using pyftpdlib + my modifications).

But i don't think that I am doing it in the most effective way. On my computer (a fairly good laptop) it usually takes half the video playtime to convert into a mp4 using a generic ffmpeg command that i simple copy and paste from stackoverflow. I tried to look up the documentation, but i simple don't have the multimedia background to understand it.

What would be the most time effective format and how to convert a raw h.265 video to it?


Solution

  • Your inputs are already H.265/HEVC, so you can simply mux them into MP4 without needing to re-encode. This will be very fast as it is "copying and pasting" the H.265 video into the MP4 container:

    ffmpeg -i input.h265 -c copy -movflags +faststart output.mp4
    

    The camera's H.265 encoder isn't as good as x265, so if you do need to shrink the file you'll need to re-encode (but be aware of generation loss):

    ffmpeg -i input.h265 -c:v libx265 -crf 28 -preset medium -movflags +faststart output.mp4
    
    • Adjust -crf and -preset to your liking. See FFmpeg Wiki: H.265 for more info about those options.

    • If libx265 is too slow use libx264 which is faster but file size will be bigger. See FFmpeg Wiki: H.264 for more info.