pythonvideoffmpegvideo-conversion

How can I use libx265 (H.265) in the ffmpeg-python package?


How can I use libx265 (H.265) in the ffmpeg-python package?

I tried using:

(
    ffmpeg
    .input('0.mp4')
    .filter('fps', fps=25, round='up')
    .output('out.mkv', format='h265')
    .run()
)

But it is throwing an error:

format is not recognized

But this works:

(
    ffmpeg
    .input('0.mp4')
    .filter('fps', fps=25, round='up')
    .output('out.mkv', format='h264')
    .run()
)

Solution

  • Replace format='h265' with vcodec='libx265'.



    Updated code:

    import ffmpeg
    
    (
        ffmpeg
        .input('0.mp4')
        .filter('fps', fps=25, round='up')
        .output('out.mkv', vcodec='libx265')
        .run()
    )