[Libav-user] Fwd: resize video stream

Сергей Икол sergbest0 at gmail.com
Mon Apr 5 11:13:49 EEST 2021

Gonzalo GarramuñoThank you very much for your help.

I think I'm completely confused ((

I just want to read the incoming video file (it contains video and audio),
then resize the video and save it in the same format (.ts).

My plan:
1. Open the video and select the desired streams (line 123-126)
2. Prepare AVCodecContext (line 207-214)
3. Decode video frame
4. I change the size of the frame (sws_scale ())
5. I encode the frame (line 352)
6. I write the frame to a file (line 372)

line 352 (avcodec_send_frame ()) constantly returns -22

it seems to me that somewhere I am making a fundamental mistake ((

сб, 3 квіт. 2021 о 16:29 Gonzalo Garramuño <ggarra13 at gmail.com> пише:

> El 3/4/21 a las 06:21, Сергей Икол escribió:
> Hello!
> I use this example
> https://github.com/leandromoreira/ffmpeg-libav-tutorial/blob/master/2_remuxing.c
> I want to change this example a little to resize the output video stream
> Is it posible?
> Can I use sws_scale() for this? Or do I need to use some other method for
> this?
> I would be glad for any advice!)
> Yes it is possible and yes you can use sws_scale for this.  Just make sure
> you are using the right pix_fmt and have the right linesizes in addition to
> the new resolution and all should be fine.
> _______________________________________________
> 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/20210405/7ad295d9/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.cpp
Type: text/x-c++src
Size: 13938 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20210405/7ad295d9/attachment.cpp>

More information about the Libav-user mailing list