<div dir="ltr"><blockquote type="cite"><div dir="ltr"><span class="gmail-im" style="color:rgb(80,0,80)"><h3 style="overflow:hidden;white-space:nowrap;font-size:0.75rem;font-weight:inherit;margin:inherit;text-overflow:ellipsis;font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;letter-spacing:0.3px;color:rgb(95,99,104);line-height:20px"><span style="outline:none"><span name="Gonzalo Garramuño" style="color:rgb(32,33,36);font-size:0.875rem;font-weight:bold;display:inline;vertical-align:top;letter-spacing:0.2px;line-height:20px"><span style="vertical-align:top">Gonzalo Garramuño<br></span></span></span></h3></span></div></blockquote>Thank you very much for your advice!<br><br>I took a slightly different example as a basis + used your advice. And now the resize of the video stream works perfectly!)<br>Now I cannot properly set up the audio stream((<br>It seems to me that the reason is that the pts of the audio stream and the video stream are too different, but I do not know how to fix it(<br><br>I'm also not sure if I need to decode the audio stream (I don't need to change it).<br>It seems to me that it is enough for me to change the pts for the audio package, but again I do not know how to do it correctly(<br><br>The audio stream has a lot of noise and, it seems to me, is reproduced with interference.<br><br>Please tell me how I can fix the problem with the audio stream?<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">пн, 5 квіт. 2021 о 18:08 Gonzalo Garramuño <<a href="mailto:ggarra13@gmail.com">ggarra13@gmail.com</a>> пише:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF">
    <p><br>
    </p>
    <div>El 5/4/21 a las 05:13, Сергей Икол
      escribió:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">
        <h3 style="overflow:hidden;white-space:nowrap;font-size:0.75rem;font-weight:inherit;margin:inherit;text-overflow:ellipsis;font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;letter-spacing:0.3px;color:rgb(95,99,104);line-height:20px"><span style="outline:none"><span name="Gonzalo Garramuño" style="color:rgb(32,33,36);font-size:0.875rem;font-weight:bold;display:inline;vertical-align:top;letter-spacing:0.2px;line-height:20px"><span style="vertical-align:top">Gonzalo Garramuño</span></span></span></h3>
        Thank you very much for your help.<br>
        <br>
        I think I'm completely confused ((<br>
        <br>
        line 352 (avcodec_send_frame ()) constantly returns -22<br>
        <br>
        it seems to me that somewhere I am making a fundamental mistake
        ((</div>
    </blockquote>
    <p>You are not initializing the codec for encoding nor opening the
      context, which are the one line in avcodec_send_frame which
      returns -22.</p>
    <p><br>
          AVCodec *codec = avcodec_find_decoder(in_cctx->codec_id)<br>
          AVCodec *encoder = avcodec_find_encoder(in_cctx->codec_id);<br>
          avcodec_open2(in_cctx, codec, NULL);<br>
          out_cctx = avcodec_alloc_context3(encoder);<br>
          out_cctx->codec = encoder;<br>
          out_cctx->bit_rate = in_cctx->bit_rate;<br>
          out_cctx->width = outWidth;<br>
          out_cctx->height = outHeight;<br>
          out_cctx->pix_fmt = AV_PIX_FMT_YUV420P;<br>
          out_cctx->time_base = (AVRational){1, 25};<br>
          out_cctx->framerate = (AVRational){25, 1};<br>
          avcodec_open2(out_cctx, encoder, NULL);</p>
    <p>}<br>
    </p>
    int attribute_align_arg avcodec_send_frame(AVCodecContext *avctx,
    const AVFrame *frame)<br>
    {<br>
        if (!avcodec_is_open(avctx) ||
    !av_codec_is_encoder(avctx->codec))<br>
          return AVERROR(EINVAL);<br>
    <br>
    // ...etc...<br>
    <p>}<br>
    </p>
    That should get you past the -22, albeit it later segfaults for
    unknown reasons (you'll need to hunt this one yourself).<br>
  </div>

_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>
<a href="https://ffmpeg.org/mailman/listinfo/libav-user" rel="noreferrer" target="_blank">https://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br>
To unsubscribe, visit link above, or email<br>
<a href="mailto:libav-user-request@ffmpeg.org" target="_blank">libav-user-request@ffmpeg.org</a> with subject "unsubscribe".</blockquote></div>