[MEncoder-users] Audio sync problem
Reimar Döffinger
Reimar.Doeffinger at gmx.de
Wed Sep 9 23:15:11 CEST 2009
On Wed, Sep 09, 2009 at 03:07:10PM +0100, Owen Williams wrote:
> On Wed, 2009-09-09 at 14:33 +0200, belcampo wrote:
> > > Freeview can/will have multiple aspect ratios in the recording so no
> > > matter what which format I'd like to have the picture centered in
> > the
> > > image with appropriate black borders for that aspect ratio at that
> > > moment in the stream.
> > I don't think that is possible. AFAIK all encoders detect aspect
> > ratio
> > and use that from start till end. If you want 4:3 in 16:9 aspect
> > you'll
> > have to add blackborders explicitely.
>
> I thought I had the magic right but this is the result after subsequent
> aspect ratio changes (for each advert in the film:
>
> http://ocean.blue.dmu.ac.uk/~williams/Film4/01.jpg
> http://ocean.blue.dmu.ac.uk/~williams/Film4/02.jpg
Please someone try attached patch.
-------------- next part --------------
Index: libmpcodecs/vf_expand.c
===================================================================
--- libmpcodecs/vf_expand.c (revision 29664)
+++ libmpcodecs/vf_expand.c (working copy)
@@ -24,6 +24,13 @@
#include "m_struct.h"
static struct vf_priv_s {
+ // These four values are a backup of the values parsed from the command line.
+ // This is necessary so that we do not get a mess upon filter reinit due to
+ // e.g. aspect changes and with only aspect specified on the command line,
+ // where we would otherwise use the values calculated for a different aspect
+ // instead of recalculating them again.
+ int cfg_exp_w, cfg_exp_h;
+ int cfg_exp_x, cfg_exp_y;
int exp_w,exp_h;
int exp_x,exp_y;
int osd;
@@ -194,6 +201,10 @@
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
if (outfmt == IMGFMT_IF09) return 0;
+ vf->priv->exp_x = vf->priv->cfg_exp_x;
+ vf->priv->exp_y = vf->priv->cfg_exp_y;
+ vf->priv->exp_w = vf->priv->cfg_exp_w;
+ vf->priv->exp_h = vf->priv->cfg_exp_h;
// calculate the missing parameters:
#if 0
if(vf->priv->exp_w<width) vf->priv->exp_w=width;
@@ -432,10 +443,10 @@
vf->get_image=get_image;
vf->put_image=put_image;
mp_msg(MSGT_VFILTER, MSGL_INFO, "Expand: %d x %d, %d ; %d, osd: %d, aspect: %lf, round: %d\n",
- vf->priv->exp_w,
- vf->priv->exp_h,
- vf->priv->exp_x,
- vf->priv->exp_y,
+ vf->priv->cfg_exp_w,
+ vf->priv->cfg_exp_h,
+ vf->priv->cfg_exp_x,
+ vf->priv->cfg_exp_y,
vf->priv->osd,
vf->priv->aspect,
vf->priv->round);
@@ -444,10 +455,10 @@
#define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f)
static m_option_t vf_opts_fields[] = {
- {"w", ST_OFF(exp_w), CONF_TYPE_INT, 0, 0 ,0, NULL},
- {"h", ST_OFF(exp_h), CONF_TYPE_INT, 0, 0 ,0, NULL},
- {"x", ST_OFF(exp_x), CONF_TYPE_INT, M_OPT_MIN, -1, 0, NULL},
- {"y", ST_OFF(exp_y), CONF_TYPE_INT, M_OPT_MIN, -1, 0, NULL},
+ {"w", ST_OFF(cfg_exp_w), CONF_TYPE_INT, 0, 0 ,0, NULL},
+ {"h", ST_OFF(cfg_exp_h), CONF_TYPE_INT, 0, 0 ,0, NULL},
+ {"x", ST_OFF(cfg_exp_x), CONF_TYPE_INT, M_OPT_MIN, -1, 0, NULL},
+ {"y", ST_OFF(cfg_exp_y), CONF_TYPE_INT, M_OPT_MIN, -1, 0, NULL},
{"osd", ST_OFF(osd), CONF_TYPE_FLAG, 0 , 0, 1, NULL},
{"aspect", ST_OFF(aspect), CONF_TYPE_DOUBLE, M_OPT_MIN, 0, 0, NULL},
{"round", ST_OFF(round), CONF_TYPE_INT, M_OPT_MIN, 1, 0, NULL},
More information about the MEncoder-users
mailing list