[Ffmpeg-devel] Fwd: How to encode video?

Michael Niedermayer michaelni
Wed Feb 14 11:45:47 CET 2007


Hi

On Wed, Feb 14, 2007 at 10:11:07AM +0000, Cool_Zer0 wrote:
> I've sent this mail to the users lists but I think that the the devel list
> is more appropriated...
> 
> ---------- Forwarded message ----------
> From: Cool_Zer0 <c00jz3r0 at gmail.com>
> Date: Feb 14, 2007 9:56 AM
> Subject: How to encode video?
> To: FFmpeg user questions and RTFMs <ffmpeg-user at mplayerhq.hu>
> 
> Hi there,
> 
> I'm trying to encode video to H.263 format...
> 
> I'm making this:
> 
> void video_encode(unsigned char* frame_rgb, int frame_rgb_size) {
>    int r = avcodec_encode_video(enc_context, frame_rgb, frame_rgb_size,
> encoded_frame);
>    ...
> 
> }
> 
> Something is missing here...

yes


> How can the encoder know that the frame_rgb contains a raw RGB frame?

AVCodecContext.pix_fmt documented in avcodec.h and surely also in the
resulting doxygen output
furthermore h.263 as writen in the h.263 spec and h263_encoder.pix_fmts
does support ONLY YUV420 not rgb so this wont help you anyway you will
have to pass yuv420 to it


> Next... encoded_frame->data is a array of 4 positions... When
> avcodec_encode_video() returns the first 3 positions of the array are set...
> How can I save the frames to disk?

well, before using a function a programmer should look at the docs, if he
cant find any docs, he looks at the source or header files, you just pass
random (and wrong) things as arguments to the function which confuses you
not surprisngly, i suggest you look at apiexample.c


> 
> I've been looking for some documentation but I can't find anything related
> to encoding video...

apiexample.c
ffmpeg.c
mencoder libmpcodecs/ve_lavc.c
the doxygen generated docs
and the source both in .c and .h files of the functions you use

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070214/1afdd68d/attachment.pgp>



More information about the ffmpeg-devel mailing list