Hello,
I've been trying to dynamically increase qcomp and qmax parameters of x264
encoder in 'ffmpeg' to reduce streaming bitrate, e.g. I 've been trying
to do it after streaming started:
void ff_set_qcomp(float qcomp, int qmax, int qmin)
{
int i;
AVOutputStream* out;
//find output video stream
for(i=0;i<nb_ostreams;i++) {
out = ost_table[i];
if (out->st->codec->codec_type == CODEC_TYPE_VIDEO)
break;
}
//create new codec cotext
AVCodecContext *ctx = avcodec_alloc_context();
ctx->codec_id = out->st->codec->codec_id;
ctx->qcompress = qcomp;
ctx->qmax = qmax;
//copy other codec context parameters
ctx->height = out->st->codec->height;
ctx->width = out->st->codec->width;
....
AVCodec* xcodec = avcodec_find_encoder(ctx->codec_id);
//close existing codec
avcodec_close(out->st->codec);
//open codec context with new parameters - returns success status
if (avcodec_open(ctx, xcodec) < 0) {
fprintf(stderr, "Error while re- 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);
}
//switch context
ost_table[i]->st->codec = ctx;
}
Right after codec context is switched, "read_packet" call returns me End Of
File. Can someone tell me what I am missing, or recommend correct approach?
Thank you in adance,
-V
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user