How can I limit ffmpeg memory usage

后端 未结 3 1358
孤独总比滥情好
孤独总比滥情好 2021-02-13 15:40

I am using ffmpeg to convert a 1080p video to MP4 using this command in PHP.

$command = FFMPEG.\' -i \' . $src . \' -sameq -strict -2 -vcodec libx264 -ar 22050 -         


        
3条回答
  •  清酒与你
    2021-02-13 15:44

    The truth is video encoding a CPU and memory intensive job. If you want to do it you need to give the requisite memory for it.

    Since you want to convert a 1080p .mov to a .mp4 of same quality I am assuming you jsut want to change the format of the file and not reencode.

    ffmpeg -i input.mov -acodec copy -vcodec copy out.mp4

    will do it in a jiffy and without any of the memory overheads

    If you want your audio codec only changed don't give the acodec part.

    If the input video codec does not work for you [so copy is not an option] try doing mpeg4 encoding for vcodec. Cheaper to encode there but I cannot assure you it will fit in your memory requirements always.

提交回复
热议问题