OpenVisualCloud / SVT-HEVC

SVT HEVC encoder. Scalable Video Technology (SVT) is a software-based video coding technology that is highly optimized for Intel® Xeon® processors. Using the open source SVT-HEVC encoder, it is possible to spread video encoding processing across multiple Intel® Xeon® processors to achieve a real advantage of processing efficiency.
Other
518 stars 170 forks source link

Some parameters are not supported in ffmpeg_plugin #579

Closed leokinglong closed 3 years ago

leokinglong commented 3 years ago
  1. Command : ./ffmpeg -i ../movie/dance.mp4 -c:v libsvt_hevc -rc 1 -b:v 60M -g 5 -r 30 -bf 0 -umv 0 -tile_slice_mode 1 -tile_row_cnt 12 -tile_col_cnt 12 -vid-info 1 -y 2_hd.hevc

  2. Result: image

Unrecognized option 'vid-info'.

  1. These parameters below are also not supported: -irefresh-type -vid-info -profile -level -tier

So how to use these parameters during encoding with ffmpeg_plugin ? Thanks~

tianjunwork commented 3 years ago

Hi @LeoKingLong, only -vid-info is not exposed. -irefresh-type is exposed by forced-idr: https://github.com/OpenVisualCloud/SVT-HEVC/blob/master/ffmpeg_plugin/0001-lavc-svt_hevc-add-libsvt-hevc-encoder-wrapper.patch#L552 profile, level, tier is exposed: https://github.com/OpenVisualCloud/SVT-HEVC/blob/master/ffmpeg_plugin/0001-lavc-svt_hevc-add-libsvt-hevc-encoder-wrapper.patch#L565

leokinglong commented 3 years ago

Hi, @tianjunwork

  1. I try with forced-idr,profile, level, tier again,it worked.

  2. Can you also expose '-vid-info' parameter? Thanks~

tianjunwork commented 3 years ago

Sure. May I know what information you need vui to carry?

leokinglong commented 3 years ago

Hi~ @tianjunwork 1 . Param '-pred-struct' is also not supporteded in ffmpeg svt plugin. ./ffmpeg -i ../movie/dance.mp4 -c:v libsvt_hevc -rc 1 -forced-idr 4 -profile 2 -tier 1 -level 0 -b:v 60M -g 5 -r 30 -bf 0 -umv 0 -tile_slice_mode 1 -tile_row_cnt 12 -tile_col_cnt 12 -preset 12 -thread_count 196 -pred-struct 0 -y 2_hd.hevc

image

  1. I use param '-bf=0' , and get the hevc file with no B-frames . ./ffmpeg -i ../movie/dance.mp4 -c:v libsvt_hevc -rc 1 -forced-idr 4 -profile 2 -tier 1 -level 0 -b:v 60M -g 5 -r 30 -bf 0 -umv 0 -tile_slice_mode 1 -tile_row_cnt 12 -tile_col_cnt 12 -preset 12 -thread_count 196 -y 2_hd.hevc

image

  1. But I set the same params with golang code, the ffmepg api encode the frame and generate a hevc file still has B-frames. (1) The golang param code :

image

func (ctxt *Context) SetTimebase(num1 int, den1 int) {
    ctxt.time_base.num = C.int(num1)
    ctxt.time_base.den = C.int(den1)
}
func (ctxt *Context) SetEncodeParams2(width int, height int, pxlFmt PixelFormat, hasBframes bool, gopSize int) {
    ctxt.width = C.int(width)
    ctxt.height = C.int(height)
    // ctxt.bit_rate = 1000000
    ctxt.gop_size = C.int(gopSize)
    // ctxt.max_b_frames = 2
    if hasBframes {
        ctxt.has_b_frames = 1
    } else {
        ctxt.has_b_frames = 0
    }
    // ctxt.extradata = nil
    // ctxt.extradata_size = 0
    // ctxt.channels = 0
    ctxt.pix_fmt = int32(pxlFmt)
    //C.av_opt_set(ctxt.priv_data, "preset", "ultrafast", 0)
}
func AvOptSet(ctxt *Context ,name string,val string, searchFlags int) int{
    return int(C.av_opt_set(((*C.struct_AVCodecContext)(ctxt)).priv_data,  C.CString(name), C.CString(val), C.int(searchFlags)))
}

(2) The log printed by the ffmpeg svt plugin when encoding the frame by ffmepg api: image

leokinglong commented 3 years ago

Sure. May I know what information you need vui to carry? @tianjunwork The vui_time_scale param. image

tianjunwork commented 3 years ago

I see, sure, we can expose -vid-info api. -pred-struct is not exposed either. NOTE: PredStructure 0 means IPPP...., no B frame. In the screenshot you posted, PredStructure is 2, which means random access hierarchical coding structure which has B frame. https://github.com/OpenVisualCloud/SVT-HEVC/blob/master/Docs/svt-hevc_encoder_user_guide.md#1-hierarchical-coding-structure-parameters

tianjunwork commented 3 years ago

Hi @guojiansheng0925 , can we expose PredStructure and VideoUsabilityInfo through ffmpeg? Thank you.

guojiansheng0925 commented 3 years ago

Hi @tianjunwork , I have submitted the MR and could you please help to review the code?

tianjunwork commented 3 years ago

Hi @LeoKingLong , the issue is automatically closed with PR merge. If you have following questions, feel free to reopen.