I think I figured out what you meant. Here's my understanding (my pixel_fmt
is PIX_FMT_YUV420P):
1). concatenate each corresponding field in avframe->data with data from
both src images (avframes);
2). double the value of each field in avframe->linesize;
3). sws_scale the avframe built with step 1) and 2) into the allocated
avframe with res. 640x480.

I'm trying it now. I'll let you know how it goes.

Best Regards.

On Fri, Mar 12, 2010 at 12:03 PM, Ke Yu <[email protected]> wrote:

> Thanks for the great idea. Following your suggestion, I scaled one of the
> source images to the allocated dest. frame (640x480). It is fast! However, I
> could only scale the first src image to the left portion of the dest. frame.
> How can I scale the second src image to the right portion of the dest.
> frame? sws_scale/sws_getContext only give sizes no location coordinates.
> Is there a way with which I can specify the coordinates as well?
>
> Thanks again!
>
> 2010/3/12 Hendrik Jürgens <[email protected]>
>
> Am 12.03.2010 01:14, schrieb Stefano Sabatini:
>>
>> On date Thursday 2010-03-11 14:21:24 -0500, Ke Yu encoded:
>>>
>>>> Hi!
>>>>
>>>> I've got avframes from two udp multicast video streams. I would like to
>>>> scale every avframe into half (only x coordinate, e.g.,
>>>> 640x480->320x480) and stitch the two scaled avframes into one avframe
>>>> with
>>>> original size (e.g., 640x480). After that, I'll encode the generated
>>>> avframes into one output video stream. My input video streams have the
>>>> same
>>>> encoding context. The frame rate is 30 fps. So I have about 33ms to
>>>> finish
>>>> the scaling and stitching. The performance is critical. I plan to use
>>>> sws_scale to scale the avframe but don't know how to stitch two scaled
>>>> avframes together. I prefer not to use a third party image lib.
>>>>
>>>> Can anyone help me to figure that out?
>>>>
>>>
>>> Try with libavfilter+overlay, integration into main SVN pending.
>>>
>>> Regards.
>>>
>>
>>
>> Hi,
>>
>> You can allocate your AVFrame with the target resolution (640x480) and
>> then let sws_scale the sourceimages directly onto this frame.
>>
>> You simply have to modify the data pointers and linepitches of yout
>> AVFrame before giving them to sws_scale. If you don't need any transparency
>> or some other fancy image stuff this should be the fastest way.
>>
>>
>> Best regards
>> Hendrik
>>
>> _______________________________________________
>> libav-user mailing list
>> [email protected]
>> https://lists.mplayerhq.hu/mailman/listinfo/libav-user
>>
>
>
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to