【问题标题】:Does a scencut feature of H.264 increases a file size?H.264 的 scencut 功能是否会增加文件大小?
【发布时间】:2016-02-10 01:43:30
【问题描述】:

当我使用这个命令时:

ffmpeg -i original.mp4 -codec:v:0 libx264  -b:v 650k -crf 21 -minrate:v 0k -maxrate:v 750k -bufsize:v 5000k -r 30 -preset slow -x264opts "no-scenecut" -vcodec libx264 -force_key_frames "expr:bitor(eq(t,0),gte(t,prev_forced_t+5))" -f mp4 test.mp4

我总是得到比这个命令更小的文件大小(相同的命令但没有:-x264opts "no-scenecut"):

ffmpeg -i original.mp4 -codec:v:0 libx264  -b:v 650k -crf 21 -minrate:v 0k -maxrate:v 750k -bufsize:v 5000k -r 30 -preset slow -vcodec libx264 -force_key_frames "expr:bitor(eq(t,0),gte(t,prev_forced_t+5))" -f mp4 test.mp4

我认为只有在使用 I 帧插入 P 或 B 帧更有效时,scencut 才会放置 I 帧。
什么情况下需要使用scencut功能?

【问题讨论】:

    标签: ffmpeg h.264 video-processing video-encoding


    【解决方案1】:

    scenecut 触发时,如果距离大于min-keyint,它会放置一个IDR,否则放置一个I-frame

    这是doom9.org forum 上发布的一些伪代码(在此处添加以供将来参考):

    encode current frame as (a really fast approximation of) a P-frame and an I-frame.
    
    if ((distance from previous keyframe) > keyint) then
        set IDR-frame
    else if (1 - (bit size of P-frame) / (bit size of I-frame) < (scenecut / 100) * (distance from previous keyframe) / keyint) then
        if ((distance from previous keyframe) >= minkeyint) then
            set IDR-frame
        else
            set I-frame
    else
        set P-frame
    
    encode frame for real.
    

    当您不需要固定 GOP/强制关键帧时,您应该使用 scenecut。如果您尝试为 ABR 交付进行编码,则您也可以使用两遍编码并在第 1 遍生成最高分辨率的 stat 文件,然后在第 2 遍中为每个再现重复使用它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-10-16
      • 1970-01-01
      • 1970-01-01
      • 2012-04-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多