2017-04-15 27 views
0

我正在嘗試創建一個過濾器以成爲FFMPEG的一部分。在創建它的過程中,我需要在框架周圍創建填充,以便圖像不會重新取樣,只需要寬度和高度。我知道這可能與libswscale/swscale.h,但我一直無法找到任何示例如何爲正在處理的飛機填充。示例代碼如下:FFMPEG庫添加填充平面/處理的幀

if (av_frame_is_writable(in)) { 
     out = in; 
    } else { 
     out = ff_get_video_buffer(outlink, outlink->w, outlink->h); 
     if (!out) { 
      av_frame_free(&in); 
      return AVERROR(ENOMEM); 
     } 
     av_frame_copy_props(out, in); 
    } 

    for (p = 0; p < filter->nb_planes; p++) { 
     // did not find any documentation as to 
     //how set those attributes to add padding to the plane 
     filter->sws_ctx = sws_getContext(src_w, src_h, src_pix_fmt, 
          dst_w, dst_h, dst_pix_fmt, 
          SWS_BILINEAR, NULL, NULL, NULL); 
    } 

回答

0

在過濾器內部沒有其他方法。功能必須從vf_pad過濾器實施。

圖片來源:@ durandal_1707 from #ffmpeg IRC