Re: YUV Overlay
[email protected] Mon, 05 Aug 2013 10:04:51 -0500
| Newsgroups | perl.sdl.devel |
|---|---|
| Message-ID | <[email protected]> |
Do you happen to have ffmpeg installed? I'm not really sure how best to list a Perl module dependency on a C library. Alien::ffmpeg seems to recompile the whole library, which shouldn't be necessary for people who already have ffmpeg installed. The code for drawing on top of the overlay is on github: https://github.com/frezik/UAV-Pilot/blob/master/lib/UAV/Pilot/SDL/VideoOverlay/Reticle.pm The "after 'init_video_overlay'" sub gets and stores the RGB color mapping. Drawing the lines is done in process_video_overlay(). Thanks, Timm On 05.08.2013 09:50, Tobias Leich wrote: > Hi, I am unable tun run that script either: > > $ perl bin/uav_video_display > perl: symbol lookup error: > > /usr/local/lib/perl/5.14.2/auto/UAV/Pilot/Video/H264Decoder/H264Decoder.so: > undefined symbol: av_init_packet > > Do you have an example of your line-drawing problem somewhere? > > Am 05.08.2013 15:58, schrieb [email protected]: >> Well, that's a bug. I'll have to update that script with the right >> module name. Thanks for letting me know. >> >> That script only dumps the video to a file without displaying it. >> The >> script 'uav_video_display', released with version 0.5, is the >> important one here. >> >> I ended up solving my overlay issue by doing most of it in C. I >> probably needed to do this, anyway, as doing it with Perl >> datastructures would have meant creating an SV for each value in the >> three YUV channels and pushing them onto an AV. 720p is 0.9 >> megapixels, so that would have been a very expensive operation to do >> 30 times a second to handle realtime video. >> >> The C technique is used in the recently released UAV::Pilot v0.5. >> >> I have run across a new problem when trying to draw on top of the >> YUV >> overlay. I can draw a line using the RGB colorspace, but it shows >> up >> black. Maybe I need to convert RGB to YUV? Or perhaps draw on a >> separate surface and blit that on top? >> >> Thanks, >> Timm >> >> On 05.08.2013 08:41, Tobias Leich wrote: >>> Hi, I installed UAV-Pilot right now, but it explodes like: >>> $ bin/uav_video_dump >>> Can't locate UAV/Pilot/Control/ARDrone/Video/FileDump.pm in @INC >>> (@INC >>> contains: /etc/perl /usr/local/lib/perl/5.14.2 >>> /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 >>> /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) >>> at >>> bin/uav_video_dump line 9. >>> BEGIN failed--compilation aborted at bin/uav_video_dump line 9. >>> >>> Is there something I can do in order to test your example script? >>> >>> Cheers, FROGGS >>> >>> Am 24.07.2013 22:53, schrieb [email protected]: >>>> I've made a simplified, standalone example: >>>> >>>> http://pastebin.com/dPPNc8VL >>>> >>>> The big array at the top is a single YUV420P frame. Expected >>>> behavior >>>> is to display that frame in a window for 5 seconds, and then quit. >>>> If >>>> I comment out the overlay handling, it displays a green >>>> background. >>>> >>>> I've verified that I'm running SDL 2.540. >>>> >>>> Thanks, >>>> Timm >>>> >>>> On 24.07.2013 08:17, Kartik Thakore wrote: >>>>> Can we run this with out needing ARDdrone? >>>>> >>>>> On Wed, Jul 24, 2013 at 8:22 AM, <[email protected]> wrote: >>>>> >>>>>> Short on time at the moment, but I have the complete code on a >>>>>> github repo: >>>>>> >>>>>> https://github.com/frezik/UAV-Pilot [2] >>>>>> >>>>>> The relevant code is in UAV::Pilot::SDL::Video, and the decoding >>>>>> happens in the xs file for UAV::Pilot::Video::H264Decoder. The >>>>>> test >>>>>> t/160_video_decode.t should run the decoding end of things. >>>>>> There's >>>>>> a test video in t_data/ardrone_video_stream_dump.bin, though >>>>>> that >>>>>> contains the PaVE headers from the UAV before each frame. Those >>>>>> headers can be stripped out by bin/uav_video_dump. >>>>>> >>>>>> I'll try to come up with a more concise example later this >>>>>> evening. >>>>>> >>>>>> Thanks, >>>>>> Timm >>>>>> >>>>>> On 24.07.2013 01 [3]:00, Tobias Leich wrote: >>>>>> >>>>>>> Hi, can you paste a complete example please? Maybe with a link >>>>>>> to a >>>>>>> test >>>>>>> video file. >>>>>>> >>>>>>> What I would try first is SDL's latest release, which is 2.540 >>>>>>> or >>>>>>> so. >>>>>>> >>>>>>> Cheers, FROGGS >>>>>>> >>>>>>> Am 23.07.2013 23:44, schrieb [email protected]: >>>>>>> >>>>>>>> I'm working on a project involving decoding h.264 video frames >>>>>>>> with >>>>>>>> ffmpeg and then outputting them to an SDL surface. From what >>>>>>>> I've >>>>>>>> read, the YUV overlay is meant for this kind of job, but I'm >>>>>>>> having >>>>>>>> trouble getting it to work with the Perl bindings. >>>>>>>> >>>>>>>> One thing that seems odd to me in the Perl docs is: >>>>>>>> >>>>>>>> As of release 2.3 direct right to overlay is disable. >>>>>>>> >>>>>>>> Besides the typos, this troubles me because it seems that >>>>>>>> disabling >>>>>>>> the feature makes the YUV overlay completely useless. >>>>>>>> >>>>>>>> Not to be deterred, I wrote this code: >>>>>>>> >>>>>>>> SDL::Video::lock_YUV_overlay( $overlay ); >>>>>>>> # The order of array indexen is correct, according to: >>>>>>>> # http://dranger.com/ffmpeg/tutorial02.html [1] >>>>>>>> my $pitches = $overlay->pitches; >>>>>>>> $$pitches[0] = scalar @{ $last_vid_frame[0] }; >>>>>>>> $$pitches[2] = scalar @{ $last_vid_frame[1] }; >>>>>>>> $$pitches[1] = scalar @{ $last_vid_frame[2] }; >>>>>>>> my $pixels = $overlay->pixels; >>>>>>>> $$pixels[0] = $last_vid_frame[0]; >>>>>>>> $$pixels[2] = $last_vid_frame[1]; >>>>>>>> $$pixels[1] = $last_vid_frame[2]; >>>>>>>> SDL::Video::unlock_YUV_overlay( $overlay ); >>>>>>>> >>>>>>>> SDL::Video::update_rects( $sdl, $bg_rect ); >>>>>>>> SDL::Video::display_YUV_overlay( $sdl, $bg_rect ); >>>>>>>> >>>>>>>> When I run this, I get an error about not being able to find >>>>>>>> the >>>>>>>> pitches() method against the class "SDL::Overlay". Eh? (Same >>>>>>>> thing >>>>>>>> happens for the pixels() method if I put that call first.) I >>>>>>>> can >>>>>>>> call >>>>>>>> width() and format() and such just fine on that object. >>>>>>>> >>>>>>>> If needed, I can handle the overlay entirely at the C level. >>>>>>>> I may >>>>>>>> end up doing that anyway; the C array that comes out of ffmpeg >>>>>>>> is >>>>>>>> being transformed into a Perl array-of-arrays, which is going >>>>>>>> to >>>>>>>> be an >>>>>>>> expensive operation to do for 720p at 30 fps in realtime. But >>>>>>>> I'd >>>>>>>> like >>>>>>>> to try this at the Perl level for now. >>>>>>>> >>>>>>>> I might also have to convert the output from ffmpeg using >>>>>>>> sws_scale(). It's coming out in YUV420P mode, and I'm using >>>>>>>> YV12 to >>>>>>>> init the overlay. But I'd like to get the above working before >>>>>>>> messing >>>>>>>> with that. >>>>>>>> >>>>>>>> Thanks, >>>>>>>> Timm Murray >>>>> >>>>> >>>>> >>>>> Links: >>>>> ------ >>>>> [1] http://dranger.com/ffmpeg/tutorial02.html >>>>> [2] https://github.com/frezik/UAV-Pilot >>>>> [3] tel:24.07.2013%2001 >>>> >>