[Ffmpeg-devel] OpenGL-Streaming ?

Joerg Anders j.anders
Wed Jan 10 17:22:57 CET 2007

On Tue, 9 Jan 2007, Luca Barbato wrote:

>> Yes and no! The OpenGL animation can supply frames in simple 24 bit RGB
>> format. I should write a codec which codes RGB to ...  what ? Or is
>> RGB already the destination format ?
> In that case you may pipe the raw data directly to ffmpeg and have it
> converted in something more compact and understandable or you may just do
> something like libavformat/dv1394.c

Please give me still one hint: In "dv1394.c" there is a function:

   dv1394_read_packet(AVFormatContext *context, AVPacket *pkt);

in "dv1394.c" near line 134

The image data is attached to the packet in

int dv_produce_packet(DVDemuxContext *c, AVPacket *pkt,
                       uint8_t* buf, int buf_size)

in "dv.c" near line 331:

     size = dv_extract_video_info(c, buf);
     pkt->data     = buf;
     pkt->size     = size;
     pkt->flags   |= PKT_FLAG_KEY;
     pkt->stream_index = c->vst->id;
     pkt->pts      = c->frames;

Instead of reading pixel form a device/file with "dv_extract_video_info" I'd fill
"buf" with the next pixel data from OpenGL-(Mesa-) animation.

But what kind of pixel data is in "buf" ? RGB24 ? YUV ? YUV420P ? ...?
I dont' know what "dv_extract_video_info" supplies?


At the end I'd register a new demuxer:

AVInputFormat opengl_demuxer = {
     .name           = "opengl",
     .long_name      = "opengl virtual reality",
     .priv_data_size = sizeof(mydata),
     .read_header    = opengl_read_header,
     .read_packet    = opengl_read_packet,
     .read_close     = opengl_close,
     .flags          = AVFMT_NOFILE

And in allformats.h:
   extern AVInputFormat opengl_demuxer;

And in allformats.c:

    ffmpeg -formats

File formats:
   D  opengl          opengl virtual reality

This already works.

But how can I bring the ffserver to use my new demuxer? Which
part in "ffserver.conf" must be changed? Is it a <Feed> or a <Stream>?
Or is it an "ffmpeg" option ?

J.Anders, GERMANY, TU Chemnitz, Fakultaet fuer Informatik

More information about the ffmpeg-devel mailing list