2017-04-15 20 views
0

FFMPEG의 일부가되도록 필터를 만들려고합니다. 그것을 만드는 과정에서 이미지가 resample되지 않도록 프레임 주위에 패딩을 만들어야합니다. 필요한 너비와 높이가 있습니다. 나는 이것이 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