[Ffmpeg-devel] modify the data of an rvb picture/frame

Rémy Bertot remy
Tue May 9 16:19:31 CEST 2006


Hello,
I'm currently trying to modify ffmpeg.c in order to create a version 
that could generate a movie with a special kind of subtitle: text (and 
pictures) that goes from right to left, used by the actors when doing a 
foreign version of an original soundtrack of a movie (this is usually 
handrawn in oldschool studios).

So, at the moment I'm trying to modify the frames by adding an option in 
do_video_out (after where the crop & padding is done), that convert the 
frame in RVB24 and do the modifications. I encounter some problems when 
accessing the frame data. Basicly this should draw a line from 
height-90px to the bottom (y=height), but it doesn't: something like 1/4 
or 1/3 of the line is missing at the bottom. Of course I get a segfault 
when I try to go any further in the array.

I'm I doing something wrong with the height or when accessing the data ? 
Or is it more likely coming from something else like the picture 
convertion? I must say that I'm pretty confused...

/*** there we go - (only convert if it's not already RGB, ie most of the 
time) */
img_convert((AVPicture *)&picture_mrt, PIX_FMT_RGB24, 
(AVPicture*)final_picture,
  target_pixfmt, enc->height, enc->width);

for(y=enc->height-90; y<enc->height; y++) {
  for(x=70;x<73;x++) {
    picture_mrt.data[0][y * picture_mrt.linesize[0] + x] = 5000;
   }
}

img_convert((AVPicture *)final_picture, enc->pix_fmt, 
(AVPicture*)&picture_mrt,
  PIX_FMT_RGB24, enc->height, enc->width);
/**** that's it */

Well, and I've another question that may be linked: is an integer 
representing the RVB color (like in Html but 10based), or do you have to 
catch each 3 bytes to get the color? I will save me some time if you 
could give me some advice.

Thanks a lot for your help, and for ffmepg...
Remy 





More information about the ffmpeg-devel mailing list