[Libav-user] Fwd: resize video stream
Сергей Икол
sergbest0 at gmail.com
Tue Apr 6 20:58:57 EEST 2021
Gonzalo Garramuño
Thank you very much for your advice!
I took a slightly different example as a basis + used your advice. And now
the resize of the video stream works perfectly!)
Now I cannot properly set up the audio stream((
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(
I'm also not sure if I need to decode the audio stream (I don't need to
change it).
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(
The audio stream has a lot of noise and, it seems to me, is reproduced with
interference.
Please tell me how I can fix the problem with the audio stream?
пн, 5 квіт. 2021 о 18:08 Gonzalo Garramuño <ggarra13 at gmail.com> пише:
>
> El 5/4/21 a las 05:13, Сергей Икол escribió:
>
> Gonzalo Garramuño Thank you very much for your help.
>
> I think I'm completely confused ((
>
> line 352 (avcodec_send_frame ()) constantly returns -22
>
> it seems to me that somewhere I am making a fundamental mistake ((
>
> You are not initializing the codec for encoding nor opening the context,
> which are the one line in avcodec_send_frame which returns -22.
>
>
> AVCodec *codec = avcodec_find_decoder(in_cctx->codec_id)
> AVCodec *encoder = avcodec_find_encoder(in_cctx->codec_id);
> avcodec_open2(in_cctx, codec, NULL);
> out_cctx = avcodec_alloc_context3(encoder);
> out_cctx->codec = encoder;
> out_cctx->bit_rate = in_cctx->bit_rate;
> out_cctx->width = outWidth;
> out_cctx->height = outHeight;
> out_cctx->pix_fmt = AV_PIX_FMT_YUV420P;
> out_cctx->time_base = (AVRational){1, 25};
> out_cctx->framerate = (AVRational){25, 1};
> avcodec_open2(out_cctx, encoder, NULL);
>
> }
> int attribute_align_arg avcodec_send_frame(AVCodecContext *avctx, const
> AVFrame *frame)
> {
> if (!avcodec_is_open(avctx) || !av_codec_is_encoder(avctx->codec))
> return AVERROR(EINVAL);
>
> // ...etc...
>
> }
> That should get you past the -22, albeit it later segfaults for unknown
> reasons (you'll need to hunt this one yourself).
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/libav-user
>
> To unsubscribe, visit link above, or email
> libav-user-request at ffmpeg.org with subject "unsubscribe".
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20210406/bc0c0852/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main2.cpp
Type: text/x-c++src
Size: 28147 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20210406/bc0c0852/attachment.cpp>
More information about the Libav-user
mailing list