First frame image data for AVI or MPEG format file

xiaoxiao2021-03-06  37

If you don't have trouble, you can use renderfile to play images, stop, then use Samplegrabber to grasp, so you can get pictures of the first frame.

The general software player is like this. After opening a media file, first pause the Filter Graph so that the first frame of this media file is naturally displayed.

IF (NO> 120) exit (0);

Sprintf (file_name, "image% 03d.ppm", no );

Save_ppm (file_name, _pixbuf);

Do a Save_ppm function, when NO = 1 is the first picture

Upstairs, use VFW programming. AVI format ...

Pavifile Pfile; // Pointer TO A Buffer That Receives The New Iavifile Interface Pointer.

Avifileinfo PFI;

Pavistream PAVI;

Pgetframe pgf;

Long Length, Start;

// Initializes the avifile library, as avifileexit ().

// Call avifileinit () Before using any other Avifile functions

Avifileinit ();

Avifileopen (& Pfile, M_avifile, of_read | of_share_deny_none, null);

// Obtains Information About An Avi File

AvifileInfo (Pfile, & Pfi, SizeOf (AvifileInfo);

AvifilegetStream (Pfile, & Pavi, StreamTypevideo, 0);

Length = avistreamlength; pavi;

START = AvistreamStart (PAVI);

AvistreamInfo Si;

AvistreamInfo (PAVI, & Si, SIZEOF (SI));

PGF = AvistreamGetframeOpen (PAVI, NULL);

// get first BMP

LpbitmapInfoHeader BMP1;

BMP1 = (lpbitmapinfohead) AvistreamGetFrame (PGF, 0);

转载请注明原文地址:https://www.9cbs.com/read-62042.html

New Post(0)