[Libav-user] Take advantage of CPU in decoding MPEG2 / H264
Jérémy
jeremy.lauraire at gmail.com
Tue Jun 21 11:16:05 CEST 2011
Hi,
I am actually writing an app that uses libavcodec to take fully advantage of my
NVidia graphic card (GeForce ENGTX470) to decode MPEG2 / H264 videos...
The app work well but the CPU is still used and no work seems to be done by the
grahique card.... :/
This topic was first treated by Bob Ingraham-2 in "What's the magic for vdpau
usage?" but not solved.
Here is part of my code :
... << INITIALISATION >> ...
//The new call since ffmpeg-0.6
av_init_packet(&_avPacket);
//FFmpeg initialization
avcodec_init();
avcodec_register_all();
//Find the codec
avCodec = avcodec_find_decoder_by_name("mpegvideo_vdpau");
//Temp AVFrame allocation
_avFrame01 = avcodec_alloc_frame();
//Output AVFrame allocation
_avFrame02 = avcodec_alloc_frame();
//Get the size of the output frame
_frameSize = avpicture_get_size( _outputFFmpegPixelFormat , _width, _height );
//To decode the video.
bytes = avcodec_decode_video2( _avCodecContext, _avFrame01, &got_picture,
&_avPacket );
if(got_picture)
.... << TRAITMENT >> ...
The stream is decoded and rendered but CPU is still at work... Is there anything
else that has to be done?
Thanks.
More information about the Libav-user
mailing list