Re: YUV Overlay
[email protected] (Kartik Thakore) Wed, 24 Jul 2013 09:17:32 -0400
| Newsgroups | perl.sdl.devel |
|---|---|
| Message-ID | <CAMiwcjbc5=3RDVYAj16cvcsxw2XTvYU6GxYcvw94096v-u6SHw@mail.gmail.com> |
--089e010d9c0870bb2e04e241bb78 Content-Type: text/plain; charset=ISO-8859-1 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<https://github.com/frezik/UAV-Pilot> > > 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: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<http://dranger.com/ffmpeg/tutorial02.html> >>> 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 >>> >> > --089e010d9c0870bb2e04e241bb78 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Can we run this with out needing ARDdrone?<br><br><div class=3D"gmail_quote= ">On Wed, Jul 24, 2013 at 8:22 AM, <span dir=3D"ltr"><<a href=3D"mailto= :[email protected]" target=3D"_blank">[email protected]</a>>= </span> wrote:<br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex">Short on time at the moment, but I have the = complete code on a github repo:<br> <br> <a href=3D"https://github.com/frezik/UAV-Pilot" target=3D"_blank">https://g= ithub.com/frezik/UAV-<u></u>Pilot</a><br> <br> The relevant code is in UAV::Pilot::SDL::Video, and the decoding happens in= the xs file for UAV::Pilot::Video::<u></u>H264Decoder. =A0The test t/160_v= ideo_decode.t should run the decoding end of things. There's a test vid= eo in t_data/ardrone_video_stream_<u></u>dump.bin, though that contains the= PaVE headers from the UAV before each frame. =A0Those headers can be strip= ped out by bin/uav_video_dump.<br> <br> I'll try to come up with a more concise example later this evening.<br> <br> Thanks,<br> Timm<div class=3D"HOEnZb"><div class=3D"h5"><br> <br> On <a href=3D"tel:24.07.2013%2001" value=3D"+12407201301" target=3D"_blank"= >24.07.2013 01</a>:00, Tobias Leich wrote:<br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex"> Hi, can you paste a complete example please? Maybe with a link to a test<br= > video file.<br> <br> What I would try first is SDL's latest release, which is 2.540 or so.<b= r> <br> Cheers, FROGGS<br> <br> Am 23.07.2013 23:44, schrieb <a href=3D"mailto:[email protected]" tar= get=3D"_blank">[email protected]</a>:<br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex"> I'm working on a project involving decoding h.264 video frames with<br> ffmpeg and then outputting them to an SDL surface. From what I've<br> read, the YUV overlay is meant for this kind of job, but I'm having<br> trouble getting it to work with the Perl bindings.<br> <br> One thing that seems odd to me in the Perl docs is:<br> <br> =A0 =A0 As of release 2.3 direct right to overlay is disable.<br> <br> Besides the typos, this troubles me because it seems that disabling<br> the feature makes the YUV overlay completely useless.<br> <br> Not to be deterred, I wrote this code:<br> <br> =A0 =A0 SDL::Video::lock_YUV_overlay( $overlay );<br> =A0 =A0 # The order of array indexen is correct, according to:<br> =A0 =A0 # <a href=3D"http://dranger.com/ffmpeg/tutorial02.html" target=3D"_= blank">http://dranger.com/ffmpeg/<u></u>tutorial02.html</a><br> =A0 =A0 my $pitches =3D $overlay->pitches;<br> =A0 =A0 $$pitches[0] =3D scalar @{ $last_vid_frame[0] };<br> =A0 =A0 $$pitches[2] =3D scalar @{ $last_vid_frame[1] };<br> =A0 =A0 $$pitches[1] =3D scalar @{ $last_vid_frame[2] };<br> =A0 =A0 my $pixels =3D $overlay->pixels;<br> =A0 =A0 $$pixels[0] =3D $last_vid_frame[0];<br> =A0 =A0 $$pixels[2] =3D $last_vid_frame[1];<br> =A0 =A0 $$pixels[1] =3D $last_vid_frame[2];<br> =A0 =A0 SDL::Video::unlock_YUV_<u></u>overlay( $overlay );<br> <br> =A0 =A0 SDL::Video::update_rects( $sdl, $bg_rect );<br> =A0 =A0 SDL::Video::display_YUV_<u></u>overlay( $sdl, $bg_rect );<br> <br> When I run this, I get an error about not being able to find the<br> pitches() method against the class "SDL::Overlay". =A0Eh? =A0(Sam= e thing<br> happens for the pixels() method if I put that call first.) I can call<br> width() and format() and such just fine on that object.<br> <br> If needed, I can handle the overlay entirely at the C level. =A0I may<br> end up doing that anyway; the C array that comes out of ffmpeg is<br> being transformed into a Perl array-of-arrays, which is going to be an<br> expensive operation to do for 720p at 30 fps in realtime. But I'd like<= br> to try this at the Perl level for now.<br> <br> I might also have to convert the output from ffmpeg using<br> sws_scale(). =A0It's coming out in YUV420P mode, and I'm using YV12= to<br> init the overlay. But I'd like to get the above working before messing<= br> with that.<br> <br> Thanks,<br> Timm Murray<br> </blockquote></blockquote> <br> </div></div></blockquote></div><br> --089e010d9c0870bb2e04e241bb78--