Hi,
On Dec 31, 2007 12:03 PM, Vitor Sessak <[EMAIL PROTECTED]> wrote:
> Hi
>
> Víctor Paesa wrote:
> > Hi,
> >
> > On Dec 31, 2007 9:04 AM, Vitor Sessak <[EMAIL PROTECTED]> wrote:
> >> Víctor Paesa wrote:
> >>> Hi,
> >>>
> >>> The filter fps seems ignored in the ffmpeg command line.
>
> [...]
>
> >>> The input and output AVI have the same 25 fps.
> >> I'm not really sure if the filter is supposed to change this. The filter
> >> infrastructure is designed to get pictures+timestamps as input and give
> >> pictures+timestamps as output. I'd say setting the output framerate is
> >> beyond filtering. For example,
> >>
> >> ffmpeg -i input.avi -vfilters fps=1 -r 25 -y output.avi
> >>
> >> should give a 25 fps output but with a different frame every 1 second.
> >> But indeed I get a crash with your command line and vf_fps.c do not
> >> seems to handle a rate greater than the input rate. I'll have a look
> >> into it...
> >
> > I feel the libavfilter framework should support frame rate change as that
> > is listed as part of the wishes/ideas for libavfilter in:
> > http://wiki.multimedia.cx/index.php?title=FFmpeg_Summer_Of_Code_2007
>
> Actually the filter framework does support frame rate change.
> If you do
>
> ffmpeg -i input.avi -vfilters fps=1 output.avi
>
> where input.avi has a rate of 25 fps, you'll have
>
> Input -> 25 fps
> Filtered input -> 1 fps
> Output -> 25 fps
>
> The only problem is that the output rate (set in ffmpeg.c) is equal by
> default to the unfiltered input rate. The filter does its job, but I
> agree it would be more reasonable to set the default output rate to the
> filtered input rate. That would unfortunately have a small problem:
> imagine for example overlaying a 20 fps and a 30 fps movie together. The
> filter output will not have a fixed frame rate, so creating and setting
> a frame_rate field in the AVFilterLink structure will not make a lot of
> sense. A second problem would be to allow broken filters to set
> frame_rate to a value not coherent with the interval between timestamps.
Yeah, I was thinking of patching vf_overlay.c as attached:
> Bobby, Michael, what is your opinion?
Regards,
Víctor
--- ../ffmpeg-11312/libavfilter/vf_overlay.c 2007-12-24 09:58:23.700402000 +0100
+++ vf_overlay.c 2007-12-31 13:03:31.174942600 +0100
@@ -25,6 +25,7 @@
typedef struct {
int x, y; //< position of subpicture
+ int pts_chosen; //< -1=lowest pts, 0=main image, 1=sub image
/** pics[0][0..1] are pictures for the main image.
* pics[1][0..1] are pictures for the sub image */
@@ -38,9 +39,14 @@
{
OverlayContext *over = ctx->priv;
- if(!args || sscanf(args, "%d:%d", &over->x, &over->y) != 2) {
over->x =
over->y = 0;
+ over->pts_chosen = -1;
+ sscanf(args, "%d:%d:%d", &over->x, &over->y, &over->pts_chosen);
+ if ((over->pts_chosen < -1)||(over->pts_chosen > 1) {
+ av_log(ctx, AV_LOG_ERROR,
+ "overlay::init PTS chosen must be either -1=lowest pts, 0=main image, or 1=sub image\n");
+ return -1
}
return 0;
@@ -175,8 +181,11 @@
copy_image(pic, x, y, over->pics[1][0], w, h,
over->bpp, over->hsub, over->vsub);
+ if (-1 == over->pts_chosen)
/* we give the output frame the higher of the two current pts values */
pic->pts = over->pics[!lower_timestamp(over)][0]->pts;
+ else
+ pic->pts = over->pics[over->pts_chosen][0]->pts;
/* and send it to the next filter */
avfilter_start_frame(link, avfilter_ref_pic(pic, ~0));
_______________________________________________
FFmpeg-soc mailing list
[email protected]
http://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-soc