FFmpeg源码分析:avcodec_send_frame()和avcodec_receive_packet()音视频编码

这篇具有很好参考价值的文章主要介绍了FFmpeg源码分析:avcodec_send_frame()和avcodec_receive_packet()音视频编码。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

FFmpeg在libavcodec模块,旧版本提供avcodec_encode_video2()作为视频编码函数,avcodec_encode_audio2()作为音频编码函数。在FFmpeg 3.1版本新增avcodec_send_frame()与avcodec_receive_packet()作为音视频编码函数。后来,在3.4版本把avcodec_encode_video2()和avcodec_encode_audio2()标记为过时API。

在上一篇文章介绍到音视频解码的分析:avcodec_send_packet和avcodec_receive_frame。

目录

一、avcodec_send_frame发送AVFrame

1、avcodec_send_frame

二、avcodec_receive_packet接收AVPacket

1、avcodec_receive_packet

2、encode_receive_packet_internal

3、encode_simple_receive_packet

4、encode_simple_internal

5、X264_frame

三、avcodec_encode_video2视频编码

四、avcodec_encode_audio2音频编码


avcodec_send_frame和avcodec_receive_packet函数定义位于libavcodec/avcodec.h:

/**
 * Supply a raw video or audio frame to the encoder. Use avcodec_receive_packet()
 * to retrieve buffered output packets.
 *
 * @param avctx     codec context
 * @param[in] frame AVFrame containing the raw audio or video frame to be encoded.
 *
 *                  For audio:
 *                  If AV_CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame
 *                  can have any number of samples.
 * @return 0 on success, otherwise negative error code:
 *      AVERROR(EAGAIN):   input is not accepted in the current state, try again.
 *      AVERROR_EOF:       the encoder has been flushed, and no new frames.
 *      AVERROR(EINVAL):   codec not opened, refcounted_frames not set, it is a
 *                         decoder, or requires flush
 *      AVERROR(ENOMEM):   failed to add packet to internal queue, or similar
 *      other errors: legitimate encoding errors
 */
int avcodec_send_frame(AVCodecContext *avctx, const AVFrame *frame);

/**
 * Read encoded data from the encoder.
 *
 * @param avctx codec context
 * @param avpkt This will be set to a reference-counted packet
 *
 * @return 0 on success, otherwise negative error code:
 *      AVERROR(EAGAIN):   output is not available in the current state, try again.
 *      AVERROR_EOF:       the encoder has been fully flushed, and there will be
 *                         no more output packets
 *      AVERROR(EINVAL):   codec not opened, or it is a decoder
 *      other errors: legitimate encoding errors
 */
int avcodec_receive_packet(AVCodecContext *avctx, AVPacket *avpkt);

由描述可知, avcodec_send_frame()负责给编码器提供未压缩的原始数据,avcodec_receive_packet()则从编码器取出编码后的数据。如果返回0,代表成功;返回AGAIN,代表当前状态没有可输出数据;返回EOF,代表已经到达输入流结尾;返回INVAL,代表编码器没有打开或者打开的是解码器。

音视频编码的函数执行流程图如下:

FFmpeg源码分析:avcodec_send_frame()和avcodec_receive_packet()音视频编码

一、avcodec_send_frame发送AVFrame

1、avcodec_send_frame

avcodec_send_frame()函数位于libavcodec/encode.c,首先判断编码器有没打开、是否为编码器,然后调用internal函数执行具体操作:

int avcodec_send_frame(AVCodecContext *avctx, const AVFrame *frame)
{
    AVCodecInternal *avci = avctx->internal;
    int ret;
    // 判断编码器有没打开,是否为编码器
    if (!avcodec_is_open(avctx) || !av_codec_is_encoder(avctx->codec))
        return AVERROR(EINVAL);
    if (avci->draining)
        return AVERROR_EOF;
    if (avci->buffer_frame->data[0])
        return AVERROR(EAGAIN);
    if (!frame) {
        avci->draining = 1;
    } else {
        ret = encode_send_frame_internal(avctx, frame);
        if (ret < 0)
            return ret;
    }

    if (!avci->buffer_pkt->data && !avci->buffer_pkt->side_data) {
        ret = encode_receive_packet_internal(avctx, avci->buffer_pkt);
        if (ret < 0 && ret != AVERROR(EAGAIN) && ret != AVERROR_EOF)
            return ret;
    }

    return 0;
}

 encode_send_frame_internal()函数没做多少事情,只是解析音频metadata、检查frame是否有效,真正的赋值操作不在这里。代码如下:

static int encode_send_frame_internal(AVCodecContext *avctx, const AVFrame *src)
{
    AVCodecInternal *avci = avctx->internal;
    AVFrame *dst = avci->buffer_frame;
    int ret;

    if (avctx->codec->type == AVMEDIA_TYPE_AUDIO) {
        // 解析音频metadata
        AVFrameSideData *sd = av_frame_get_side_data(src, AV_FRAME_DATA_AUDIO_SERVICE_TYPE);
        if (sd && sd->size >= sizeof(enum AVAudioServiceType))
            avctx->audio_service_type = *(enum AVAudioServiceType*)sd->data;
        // 检查frame大小是否有效
        if (avctx->codec->capabilities & AV_CODEC_CAP_SMALL_LAST_FRAME) {
            if (src->nb_samples > avctx->frame_size) {
                return AVERROR(EINVAL);
            }
        } else if (!(avctx->codec->capabilities & AV_CODEC_CAP_VARIABLE_FRAME_SIZE)) {
            if (avctx->internal->last_audio_frame) {
                return AVERROR(EINVAL);
            }
            if (src->nb_samples < avctx->frame_size) {
                ret = pad_last_frame(avctx, dst, src);
                if (ret < 0)
                    return ret;
                avctx->internal->last_audio_frame = 1;
            } else if (src->nb_samples > avctx->frame_size) {
                return AVERROR(EINVAL);
            }
        }
    }
    if (!dst->data[0]) {
        ret = av_frame_ref(dst, src);
        if (ret < 0)
             return ret;
    }

    return 0;
}

二、avcodec_receive_packet接收AVPacket

1、avcodec_receive_packet

avcodec_receive_packet()函数也是首先编码器是否打开、是否为编码器,然后调用encode_receive_packet_internal()函数去执行具体操作:

int avcodec_receive_packet(AVCodecContext *avctx, AVPacket *avpkt)
{
    AVCodecInternal *avci = avctx->internal;
    int ret;
    av_packet_unref(avpkt);
    // 判断编码器是否打开,是否为编码器
    if (!avcodec_is_open(avctx) || !av_codec_is_encoder(avctx->codec))
        return AVERROR(EINVAL);

    if (avci->buffer_pkt->data || avci->buffer_pkt->side_data) {
        av_packet_move_ref(avpkt, avci->buffer_pkt);
    } else {
        ret = encode_receive_packet_internal(avctx, avpkt);
        if (ret < 0)
            return ret;
    }

    return 0;
}

2、encode_receive_packet_internal

encode_receive_packet_internal()函数首先检测视频宽高、像素格式,然后判断使用receive_packet还是encode_simple_receive_packet执行编码操作:

static int encode_receive_packet_internal(AVCodecContext *avctx, AVPacket *avpkt)
{
    AVCodecInternal *avci = avctx->internal;
    int ret;

    if (avci->draining_done)
        return AVERROR_EOF;
    // 检查视频宽、高、像素格式
    if (avctx->codec->type == AVMEDIA_TYPE_VIDEO) {
        if (av_image_check_size2(avctx->width, avctx->height, 
			avctx->max_pixels, AV_PIX_FMT_NONE, 0, avctx))
            return AVERROR(EINVAL);
    }
    // 判断使用receive_packet还是encode_simple_receive_packet编码
    if (avctx->codec->receive_packet) {
        ret = avctx->codec->receive_packet(avctx, avpkt);
        if (ret < 0)
            av_packet_unref(avpkt);
        else
            av_assert0(!avpkt->data || avpkt->buf);
    } else
        ret = encode_simple_receive_packet(avctx, avpkt);

    if (ret == AVERROR_EOF)
        avci->draining_done = 1;

    return ret;
}

3、encode_simple_receive_packet

encode_simple_receive_packet()函数比较简单,主要是调用encode_simple_internal()函数:

static int encode_simple_receive_packet(AVCodecContext *avctx, AVPacket *avpkt)
{
    int ret;

    while (!avpkt->data && !avpkt->side_data) {
        ret = encode_simple_internal(avctx, avpkt);
        if (ret < 0)
            return ret;
    }

    return 0;
}

4、encode_simple_internal

encode_simple_internal()函数首先判断frame,如果frame为空则调用ff_encode_get_frame()取出一帧未压缩的数据,然后判断使用ff_thread_video_encode_frame还是avctx->codec->encode2执行真正的编码操作:

static int encode_simple_internal(AVCodecContext *avctx, AVPacket *avpkt)
{
    AVCodecInternal   *avci = avctx->internal;
    EncodeSimpleContext *es = &avci->es;
    AVFrame          *frame = es->in_frame;
    int got_packet;
    int ret;

    if (avci->draining_done)
        return AVERROR_EOF;
    // 如果frame为空,调用ff_encode_get_frame取一帧数据
    if (!frame->buf[0] && !avci->draining) {
        av_frame_unref(frame);
        ret = ff_encode_get_frame(avctx, frame);
        if (ret < 0 && ret != AVERROR_EOF)
            return ret;
    }
    if (!frame->buf[0]) {
        if (!(avctx->codec->capabilities & AV_CODEC_CAP_DELAY ||
              (avci->frame_thread_encoder && avctx->active_thread_type 
			  & FF_THREAD_FRAME)))
            return AVERROR_EOF;
        frame = NULL;
    }
    got_packet = 0;
    // 判断使用ff_thread_video_encode_frame还是avctx->codec->encode2进行编码
    if (CONFIG_FRAME_THREAD_ENCODER &&
        avci->frame_thread_encoder && (avctx->active_thread_type & FF_THREAD_FRAME))
        ret = ff_thread_video_encode_frame(avctx, avpkt, frame, &got_packet);
    else {
        ret = avctx->codec->encode2(avctx, avpkt, frame, &got_packet);
        if (avctx->codec->type == AVMEDIA_TYPE_VIDEO && !ret && got_packet &&
            !(avctx->codec->capabilities & AV_CODEC_CAP_DELAY))
            avpkt->pts = avpkt->dts = frame->pts;
    }

    if (!ret && got_packet) {
        if (avpkt->data) {
            ret = av_packet_make_refcounted(avpkt);
            if (ret < 0)
                goto end;
        }
        if (frame && !(avctx->codec->capabilities & AV_CODEC_CAP_DELAY)) {
            if (avctx->codec->type == AVMEDIA_TYPE_AUDIO) {
                if (avpkt->pts == AV_NOPTS_VALUE)
                    avpkt->pts = frame->pts;
                if (!avpkt->duration)
                    avpkt->duration = ff_samples_to_time_base(
				        avctx, frame->nb_samples);
            }
        }
        // 如果是音频,flags都设为关键帧
        if (avctx->codec->type == AVMEDIA_TYPE_AUDIO) {
            avpkt->flags |= AV_PKT_FLAG_KEY;
            avpkt->dts = avpkt->pts;
        }
    }

    if (avci->draining && !got_packet)
        avci->draining_done = 1;

end:
    if (ret < 0 || !got_packet)
        av_packet_unref(avpkt);
    if (frame) {
        if (!ret)
            avctx->frame_number++;
        av_frame_unref(frame);
    }

    return ret;
}

 在上面有提到,avcodec_send_frame()函数没有进行frame的赋值操作,真正执行赋值操作的是ff_encode_get_frame()函数,具体如下:

int ff_encode_get_frame(AVCodecContext *avctx, AVFrame *frame)
{
    AVCodecInternal *avci = avctx->internal;

    if (avci->draining)
        return AVERROR_EOF;
    if (!avci->buffer_frame->buf[0])
        return AVERROR(EAGAIN);
    // avci->buffer_frame赋值给frame
    av_frame_move_ref(frame, avci->buffer_frame);

    return 0;
}

5、X264_frame

以libx264编码器为例,位于libavcodec/libx264.c,对应的AVCodec如下:

AVCodec ff_libx264_encoder = {
    .name             = "libx264",
    .long_name        = NULL_IF_CONFIG_SMALL("libx264 H.264/AVC /MPEG-4 part10"),
    .type             = AVMEDIA_TYPE_VIDEO,
    .id               = AV_CODEC_ID_H264,
    .priv_data_size   = sizeof(X264Context),
    .init             = X264_init,
    .encode2          = X264_frame,
    .close            = X264_close,
    .capabilities     = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_OTHER_THREADS |
                        AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
    .caps_internal    = FF_CODEC_CAP_AUTO_THREADS,
    .priv_class       = &x264_class,
    .defaults         = x264_defaults,
    .pix_fmts         = pix_fmts_all,
    .wrapper_name     = "libx264",
};

此时,encode2函数指针指向X264_frame,代码如下:

static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame,
                      int *got_packet)
{
    X264Context *x4 = ctx->priv_data;
    x264_nal_t *nal;
    int nnal, i, ret;
    x264_picture_t pic_out = {0};
    int pict_type;
    int bit_depth;
    int64_t wallclock = 0;
    X264Opaque *out_opaque;
    AVFrameSideData *sd;
    // 初始化x264编码器相关参数
    x264_picture_init( &x4->pic );
    x4->pic.img.i_csp = x4->params.i_csp;
#if X264_BUILD >= 153
    bit_depth = x4->params.i_bitdepth;
#else
    bit_depth = x264_bit_depth;
#endif
    if (bit_depth > 8)
        x4->pic.img.i_csp |= X264_CSP_HIGH_DEPTH;
    x4->pic.img.i_plane = avfmt2_num_planes(ctx->pix_fmt);

    if (frame) {
        for (i = 0; i < x4->pic.img.i_plane; i++) {
            x4->pic.img.plane[i]    = frame->data[i];
            x4->pic.img.i_stride[i] = frame->linesize[i];
        }

        x4->pic.i_pts  = frame->pts;
        x4->reordered_opaque[x4->next_reordered_opaque].reordered_opaque = frame->reordered_opaque;
        x4->reordered_opaque[x4->next_reordered_opaque].wallclock = wallclock;
        if (ctx->export_side_data & AV_CODEC_EXPORT_DATA_PRFT)
            x4->reordered_opaque[x4->next_reordered_opaque].wallclock = av_gettime();
        x4->pic.opaque = &x4->reordered_opaque[x4->next_reordered_opaque];
        x4->next_reordered_opaque++;
        x4->next_reordered_opaque %= x4->nb_reordered_opaque;
        // 给x264的pic.i_type赋值,包括IDR、I、P、B帧类型
        switch (frame->pict_type) {
        case AV_PICTURE_TYPE_I:
            x4->pic.i_type = x4->forced_idr > 0 ? X264_TYPE_IDR
                                                : X264_TYPE_KEYFRAME;
            break;
        case AV_PICTURE_TYPE_P:
            x4->pic.i_type = X264_TYPE_P;
            break;
        case AV_PICTURE_TYPE_B:
            x4->pic.i_type = X264_TYPE_B;
            break;
        default:
            x4->pic.i_type = X264_TYPE_AUTO;
            break;
        }
		// 重新配置编码器
        reconfig_encoder(ctx, frame);

        ......
    }

    do {
		// 调用x264_encoder_encode()执行编码
        if (x264_encoder_encode(x4->enc, &nal, &nnal, frame? &x4->pic: NULL, &pic_out) < 0)
            return AVERROR_EXTERNAL;
        // 对nal单元进行编码
        ret = encode_nals(ctx, pkt, nal, nnal);
        if (ret < 0)
            return ret;
    } while (!ret && !frame && x264_encoder_delayed_frames(x4->enc));

    if (!ret)
        return 0;

    pkt->pts = pic_out.i_pts;
    pkt->dts = pic_out.i_dts;
    out_opaque = pic_out.opaque;
    if (out_opaque >= x4->reordered_opaque &&
        out_opaque < &x4->reordered_opaque[x4->nb_reordered_opaque]) {
        ctx->reordered_opaque = out_opaque->reordered_opaque;
        wallclock = out_opaque->wallclock;
    } else {
        ctx->reordered_opaque = 0;
    }
    // 给pict_type赋值,包括I、P、B帧类型
    switch (pic_out.i_type) {
    case X264_TYPE_IDR:
    case X264_TYPE_I:
        pict_type = AV_PICTURE_TYPE_I;
        break;
    case X264_TYPE_P:
        pict_type = AV_PICTURE_TYPE_P;
        break;
    case X264_TYPE_B:
    case X264_TYPE_BREF:
        pict_type = AV_PICTURE_TYPE_B;
        break;
    default:
        return AVERROR_EXTERNAL;
    }
    pkt->flags |= AV_PKT_FLAG_KEY*pic_out.b_keyframe;
    if (ret) {
        ff_side_data_set_encoder_stats(pkt, 
			(pic_out.i_qpplus1 - 1) * FF_QP2LAMBDA, NULL, 0, pict_type);
        if (wallclock)
            ff_side_data_set_prft(pkt, wallclock);
    }

    *got_packet = ret;
    return 0;
}

由此可见,X264_frame()函数主要有6个步骤:

  • 初始化x264编码器相关参数;
  • 给x264的pic.i_type赋值,包括IDR、I、P、B帧类型;
  • 调用reconfig_encoder()重新配置编码器;
  • 调用x264_encoder_encode()执行编码;
  • 对nal单元进行编码;
  • 给输出的pict_type赋值,包括I、P、B帧类型;

三、avcodec_encode_video2视频编码

由于avcodec_encode_video2()函数已经过时,所以内部提供compat_encode()来兼容旧版本,具体代码如下:

int avcodec_encode_video2(AVCodecContext *avctx,
                                              AVPacket *avpkt,
                                              const AVFrame *frame,
                                              int *got_packet_ptr)
{
    int ret = compat_encode(avctx, avpkt, got_packet_ptr, frame);

    if (ret < 0)
        av_packet_unref(avpkt);

    return ret;
}

我们来看看compat_encode()函数源码,其实内部也是调用avcodec_send_frame()和avcodec_receive_packet()进行编码,具体如下: 

static int compat_encode(AVCodecContext *avctx, AVPacket *avpkt,
                         int *got_packet, const AVFrame *frame)
{
    AVCodecInternal *avci = avctx->internal;
    AVPacket user_pkt;
    int ret;
    *got_packet = 0;
    // 检测视频的pixel_format、width、height
    if (frame && avctx->codec->type == AVMEDIA_TYPE_VIDEO) {
        if (frame->format == AV_PIX_FMT_NONE)
            av_log(avctx, AV_LOG_WARNING, "format is not set\n");
        if (frame->width == 0 || frame->height == 0)
            av_log(avctx, AV_LOG_WARNING, "width or height is not set\n");
    }
    // 调用avcodec_send_frame()发送frame
    ret = avcodec_send_frame(avctx, frame);
    if (ret == AVERROR_EOF)
        ret = 0;
    else if (ret == AVERROR(EAGAIN)) {
        return AVERROR_BUG;
    } else if (ret < 0)
        return ret;

    av_packet_move_ref(&user_pkt, avpkt);
    while (ret >= 0) {
		// 调用avcodec_receive_packet()接收packet
        ret = avcodec_receive_packet(avctx, avpkt);
        if (ret < 0) {
            if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
                ret = 0;
            goto finish;
        }

        if (avpkt != avci->compat_encode_packet) {
            if (avpkt->data && user_pkt.data) {
                if (user_pkt.size >= avpkt->size) {
                    memcpy(user_pkt.data, avpkt->data, avpkt->size);
                    av_buffer_unref(&avpkt->buf);
                    avpkt->buf  = user_pkt.buf;
                    avpkt->data = user_pkt.data;
                } else {
                    av_packet_unref(avpkt);
                    ret = AVERROR(EINVAL);
                    goto finish;
                }
            }

            *got_packet = 1;
            avpkt = avci->compat_encode_packet;
        } else {
            if (!avci->compat_decode_warned) {
                avci->compat_decode_warned = 1;
                av_packet_unref(avpkt);
            }
        }
        if (avci->draining)
            break;
    }

finish:
    if (ret < 0)
        av_packet_unref(&user_pkt);

    return ret;
}

四、avcodec_encode_audio2音频编码

和avcodec_encode_video2()函数一样,avcodec_encode_audio2()函数已经过时,内部也是提供compat_encode()来兼容旧版本,具体代码如下:

int avcodec_encode_audio2(AVCodecContext *avctx,
                                              AVPacket *avpkt,
                                              const AVFrame *frame,
                                              int *got_packet_ptr)
{
    int ret = compat_encode(avctx, avpkt, got_packet_ptr, frame);

    if (ret < 0)
        av_packet_unref(avpkt);

    return ret;
}

至此,avcodec_send_frame()和avcodec_receive_packet()组成的编码函数已经分析完毕。

学习FFmpeg与代码实践,可参考:FFmpegAndroid文章来源地址https://www.toymoban.com/news/detail-410283.html

到了这里,关于FFmpeg源码分析:avcodec_send_frame()和avcodec_receive_packet()音视频编码的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • FFmpeg5.0源码阅读——av_interleaved_write_frame

       摘要 :本文主要详细描述FFmpeg中封装时写packet到媒体文件的函数 av_interleaved_write_frame 的实现。    : av_interleaved_write_frame    读者须知 :读者需要熟悉ffmpeg的基本使用。    av_interleaved_write_frame 的基本调用流程图如下。   首先就是根据输入数据是否为空

    2024年02月14日
    浏览(36)
  • ffmpeg.c源码与函数关系分析

    FFmpeg 是一个可以处理音视频的软件,功能非常强大,主要包括,编解码转换,封装格式转换,滤镜特效。 FFmpeg支持各种网络协议,支持 RTMP ,RTSP,HLS 等高层协议的推拉流,也支持更底层的TCP/UDP 协议推拉流。 FFmpeg 可以在 Windows,Linux,Mac,iOS,Android等操作系统上运行。 F

    2024年02月14日
    浏览(24)
  • (02)Cartographer源码无死角解析-(78) ROS数据发布→2D点云数据、tf、机器人tracking frame轨迹发布

    讲解关于slam一系列文章汇总链接:史上最全slam从零开始,针对于本栏目讲解(02)Cartographer源码无死角解析-链接如下: (02)Cartographer源码无死角解析- (00)目录_最新无死角讲解:https://blog.csdn.net/weixin_43013761/article/details/127350885   文末正下方中心提供了本人 联系方式, 点击本人照片

    2024年02月12日
    浏览(33)
  • FFMPEG源码之ffmpeg.c解析

    下面是对每个步骤的功能的详细解释: 初始化动态加载。 调用init_dynload函数,用于初始化动态加载库的相关资源,以便在需要时加载需要的库。 注册退出回调函数。 调用register_exit函数,将ffmpeg_cleanup函数注册为在程序退出时被调用的回调函数。 设置stderr的缓冲模式。 调用

    2024年02月15日
    浏览(33)
  • FFmpeg5.0源码阅读——FFmpeg大体框架

       摘要 :前一段时间熟悉了下FFmpeg主流程源码实现,对FFmpeg的整体框架有了个大概的认识,因此在此做一个笔记,希望以比较容易理解的文字描述FFmpeg本身的结构,加深对FFmpeg的框架进行梳理加深理解,如果文章中有纰漏或者错误欢迎指出。本文描述了FFmpeg编解码框架的

    2024年02月11日
    浏览(34)
  • FFmpeg开发笔记(六)如何访问Github下载FFmpeg源码

    ​ 学习FFmpeg的时候,经常要到GitHub下载各种开源代码,比如FFmpeg的源码页面位于https://github.com/FFmpeg/FFmpeg。然而国内访问GitHub很不稳定,经常打不开该网站,比如在命令行执行下面的ping命令。 上面的ping结果如下所示,可见默认解析的DNS地址连接超时。 现在GitHub的DNS请求超时

    2024年03月17日
    浏览(51)
  • FFmpeg学习:FFmpeg4数据结构分析

    FFMPEG中结构体很多。最关键的结构体可以分成以下几类: 1、解协议(http,rtsp,rtmp,mms) AVIOContext,URLProtocol,URLContext主要存储视音频使用的协议的类型以及状态。URLProtocol存储输入视音频使用的封装格式。每种协议都对应一个URLProtocol结构。(注意:FFMPEG中文件也被当做一种协

    2024年02月05日
    浏览(67)
  • [FFmpeg] 源码编译

    git clone https://git.ffmpeg.org/ffmpeg.git git checkout -b 5.1 remotes/origin/release/5.1 ./configure --prefix=./OUT --enable-shared --disable-static make make install 默认安装路径见: /usr/local/bin /usr/local/include /usr/local/lib /usr/local/main/man1 /usr/local/main/man3 有 --prefix 参数的安装路径: [prefix]/bin [prefix]/include [prefix

    2024年02月10日
    浏览(27)
  • 源码编译FFmpeg4.3

    FreeSWITCH的mod_av模块目前(1.10.11)暂不支持FFmpeg4.4(或者更高版本),但4.3就没问题 最近试了试源码编译FFmpeg4.3,记录如下(系统centos7.9): git clone GitHub - BtbN/FFmpeg-Builds 找到4.4.sh,改成这样: GIT_BRANCH=\\\"release/4.3\\\" ./build.sh linux64 gpl 4.4 cd ffbuild/ffmpeg ./configure --enable-shared make

    2024年02月01日
    浏览(29)
  • FFmpeg源码走读之内存管理模型

    数据包管理过程中当数据转移到新的数据包时存在两种操作一种是数据包之间相互独立,当新创建一份数据包时,需要将原来的数据重新申请一个数据空间并且将数据拷贝到新的数据包中,具体过程如下图所示。这种数据包的管理优势是在于数据之间相互独立,不会存在数据

    2023年04月24日
    浏览(25)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包