static int video_qmax = 31;
static int video_lmin = 2*FF_QP2LAMBDA;
static int video_lmax = 31*FF_QP2LAMBDA;
-static int video_mb_qmin = 2;
-static int video_mb_qmax = 31;
+static int video_mb_lmin = 2*FF_QP2LAMBDA;
+static int video_mb_lmax = 31*FF_QP2LAMBDA;
static int video_qdiff = 3;
static int video_lelim = 0;
static int video_celim = 0;
static int video_inter_quant_bias= FF_DEFAULT_QUANT_BIAS;
static int me_method = ME_EPZS;
static int video_disable = 0;
+static int video_discard = 0;
static int video_codec_id = CODEC_ID_NONE;
static int video_codec_tag = 0;
static int same_quality = 0;
static int qns = 0;
static int closed_gop = 0;
static int strict_gop = 0;
+static int no_output = 0;
static int do_deinterlace = 0;
static int do_interlace_dct = 0;
static int do_interlace_me = 0;
optr = img->data[i] + (img->linesize[i] * (padtop >> shift)) +
(img->linesize[i] - (padright >> shift));
- for (y = 0; y < ((height - (padtop + padbottom)) >> shift); y++) {
+ for (y = 0; y < ((height - (padtop + padbottom) - 1) >> shift); y++) {
memset(optr, color[i], (padleft + padright) >> shift);
optr += img->linesize[i];
}
}
- if (padbottom) {
- optr = img->data[i] + (img->linesize[i] * ((height - padbottom) >> shift));
- memset(optr, color[i], ((img->linesize[i] * padbottom) >> shift));
+ if (padbottom || padright) {
+ optr = img->data[i] + (((img->linesize[i] * (height - padbottom)) - padright) >> shift);
+ memset(optr, color[i], (((img->linesize[i] * padbottom) + padright) >> shift));
}
}
}
} else if (pkt->dts != AV_NOPTS_VALUE) { //FIXME seems redundant, as libavformat does this too
ist->next_pts = ist->pts = pkt->dts;
} else {
- assert(ist->pts == ist->next_pts);
+// assert(ist->pts == ist->next_pts);
}
if (pkt == NULL) {
codec->frame_rate_base = icodec->frame_rate_base;
codec->width = icodec->width;
codec->height = icodec->height;
+ codec->has_b_frames = icodec->has_b_frames;
break;
default:
av_abort();
exit(1);
}
if (avcodec_open(&ost->st->codec, codec) < 0) {
- fprintf(stderr, "Error while opening codec for stream #%d.%d - maybe incorrect parameters such as bit_rate, rate, width or height\n",
+ fprintf(stderr, "Error while opening codec for output stream #%d.%d - maybe incorrect parameters such as bit_rate, rate, width or height\n",
ost->file_index, ost->index);
exit(1);
}
static void opt_qmin(const char *arg)
{
video_qmin = atoi(arg);
- if (video_qmin < 0 ||
+ if (video_qmin < 1 ||
video_qmin > 31) {
fprintf(stderr, "qmin must be >= 1 and <= 31\n");
exit(1);
static void opt_qmax(const char *arg)
{
video_qmax = atoi(arg);
- if (video_qmax < 0 ||
+ if (video_qmax < 1 ||
video_qmax > 31) {
fprintf(stderr, "qmax must be >= 1 and <= 31\n");
exit(1);
}
}
-static void opt_mb_qmin(const char *arg)
+static void opt_mb_lmin(const char *arg)
{
- video_mb_qmin = atoi(arg);
- if (video_mb_qmin < 0 ||
- video_mb_qmin > 31) {
- fprintf(stderr, "qmin must be >= 1 and <= 31\n");
+ video_mb_lmin = atof(arg)*FF_QP2LAMBDA;
+ if (video_mb_lmin < 1 ||
+ video_mb_lmin > FF_LAMBDA_MAX) {
+ fprintf(stderr, "mblmin must be >= 1 and <= %d\n", FF_LAMBDA_MAX / FF_QP2LAMBDA);
exit(1);
}
}
-static void opt_mb_qmax(const char *arg)
+static void opt_mb_lmax(const char *arg)
{
- video_mb_qmax = atoi(arg);
- if (video_mb_qmax < 0 ||
- video_mb_qmax > 31) {
- fprintf(stderr, "qmax must be >= 1 and <= 31\n");
+ video_mb_lmax = atof(arg)*FF_QP2LAMBDA;
+ if (video_mb_lmax < 1 ||
+ video_mb_lmax > FF_LAMBDA_MAX) {
+ fprintf(stderr, "mblmax must be >= 1 and <= %d\n", FF_LAMBDA_MAX / FF_QP2LAMBDA);
exit(1);
}
}
//fprintf(stderr, "\nInput Audio channels: %d", enc->channels);
audio_channels = enc->channels;
audio_sample_rate = enc->sample_rate;
+ if(audio_disable)
+ ic->streams[i]->discard= AVDISCARD_ALL;
break;
case CODEC_TYPE_VIDEO:
frame_height = enc->height;
frame_rate_base = rfps_base;
enc->rate_emu = rate_emu;
+ if(video_disable)
+ ic->streams[i]->discard= AVDISCARD_ALL;
+ else if(video_discard)
+ ic->streams[i]->discard= video_discard;
break;
case CODEC_TYPE_DATA:
break;
video_enc->gop_size = 0;
if (video_qscale || same_quality) {
video_enc->flags |= CODEC_FLAG_QSCALE;
+ video_enc->global_quality=
st->quality = FF_QP2LAMBDA * video_qscale;
}
if (do_interlace_me) {
video_enc->flags |= CODEC_FLAG_INTERLACED_ME;
}
+ if (no_output) {
+ video_enc->flags2 |= CODEC_FLAG2_NO_OUTPUT;
+ }
video_enc->qmin = video_qmin;
video_enc->qmax = video_qmax;
video_enc->lmin = video_lmin;
video_enc->rc_qsquish = video_qsquish;
video_enc->luma_elim_threshold = video_lelim;
video_enc->chroma_elim_threshold = video_celim;
- video_enc->mb_qmin = video_mb_qmin;
- video_enc->mb_qmax = video_mb_qmax;
+ video_enc->mb_lmin = video_mb_lmin;
+ video_enc->mb_lmax = video_mb_lmax;
video_enc->max_qdiff = video_qdiff;
video_enc->qblur = video_qblur;
video_enc->qcompress = video_qcomp;
static void opt_target(const char *arg)
{
int norm = -1;
- static const char const *frame_rates[] = {"25", "30000/1001", "24000/1001"};
+ static const char *const frame_rates[] = {"25", "30000/1001", "24000/1001"};
if(!strncmp(arg, "pal-", 4)) {
norm = 0;
{ "g", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_gop_size}, "set the group of picture size", "gop_size" },
{ "intra", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&intra_only}, "use only intra frames"},
{ "vn", OPT_BOOL | OPT_VIDEO, {(void*)&video_disable}, "disable video" },
+ { "vdt", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&video_discard}, "discard threshold", "n" },
{ "qscale", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_qscale}, "use fixed video quantiser scale (VBR)", "q" },
{ "qmin", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_qmin}, "min video quantiser scale (VBR)", "q" },
{ "qmax", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_qmax}, "max video quantiser scale (VBR)", "q" },
{ "lmin", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_lmin}, "min video lagrange factor (VBR)", "lambda" },
{ "lmax", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_lmax}, "max video lagrange factor (VBR)", "lambda" },
- { "mbqmin", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_mb_qmin}, "min macroblock quantiser scale (VBR)", "q" },
- { "mbqmax", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_mb_qmax}, "max macroblock quantiser scale (VBR)", "q" },
+ { "mblmin", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_mb_lmin}, "min macroblock quantiser scale (VBR)", "q" },
+ { "mblmax", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_mb_lmax}, "max macroblock quantiser scale (VBR)", "q" },
{ "qdiff", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_qdiff}, "max difference between the quantiser scale (VBR)", "q" },
{ "qblur", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_qblur}, "video quantiser scale blur (VBR)", "blur" },
{ "qsquish", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_qsquish}, "how to keep quantiser between qmin and qmax (0 = clip, 1 = use differentiable function)", "squish" },
{ "naq", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&do_normalize_aqp}, "normalize adaptive quantization" },
{ "cgop", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&closed_gop}, "closed gop" },
{ "sgop", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&strict_gop}, "strict gop" },
+ { "noout", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&no_output}, "skip bitstream encoding" },
{ "scan_offset", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&use_scan_offset}, "enable SVCD Scan Offset placeholder" },
{ "qpel", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&use_qpel}, "enable 1/4-pel" },
{ "intra_matrix", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_intra_matrix}, "specify intra matrix coeffs", "matrix" },