简体   繁体   English

FFMPEG:视频比特率的动态变化

[英]FFMPEG: Dynamic change of bit_rate for Video

I use ffmpeg codes in my C++ app and would like to control the bit_rate parameter for VIDEO there.我在我的 C++ 应用程序中使用 ffmpeg 代码,并想在那里控制 VIDEO 的 bit_rate 参数。 I tried to change its value in work (via ost->st->codec->codec->bit_rate), but ffmpeg did not wish to change it.我试图在工作中更改它的值(通过 ost->st->codec->codec->bit_rate),但 ffmpeg 不想更改它。 Perhaps anybody knows how to make it?也许有人知道怎么做?

Any ideas?有任何想法吗?

I have tried like this and its working for me.我试过这样,它对我有用。

     avcodec_init();

     avcodec_register_all();

     codec = avcodec_find_encoder(CODEC_ID_H263);

     c = avcodec_alloc_context();

     picture= avcodec_alloc_frame();

        c->bit_rate = bitrate;
        c->width = w;
        c->height = h;
        c->time_base= (AVRational){1,framerate};
        c->pix_fmt = PIX_FMT_YUV420P;

avcodec_close(c);

av_free(c);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ffmpeg:为输出流 #0:0 打开编码器时出错 - 可能不正确的参数,例如比特率、速率、宽度或高度 - ffmpeg : Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height FFMPEG无法为打开输出流#0:0的编码器转码mp4错误-可能是不正确的参数,例如bit_rate,rate,width或height - FFMPEG failed to transcode mp4 Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height FFMPEG CBR(恒定比特率模式),可保持视频质量 - FFMPEG CBR (Constant Bit Rate mode) with maintain video quality 更改视频分辨率 ffmpeg - Change video resolution ffmpeg 如何计算视频的比特率? - How to calculate bit rate of video? FFmpeg:如何使用 C++ 代码更改视频文件的帧速率? - FFmpeg: how to use C++ code to change the frame rate of a video file? 如何使用 FFmpeg、无损并保持相同的总帧数来更改视频帧速率? - How can I change a video frame rate with FFmpeg, lossless and keeping the same total number of frames? 是否可以设置twilio视频的比特率? - Is it possible to set the bit rate for twilio video? 确定视频的未压缩比特率 - Determining the uncompressed bit-rate of a video 使用ffmpeg提取每一帧以形成可变帧率视频 - Extract every frame form a variable-frame-rate video with ffmpeg
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM