国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

windows下使用FFmpeg開源庫進(jìn)行視頻編解碼完整步聚

這篇具有很好參考價(jià)值的文章主要介紹了windows下使用FFmpeg開源庫進(jìn)行視頻編解碼完整步聚。希望對大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

最終解碼效果:

windows下使用FFmpeg開源庫進(jìn)行視頻編解碼完整步聚,FFMPEG,ffmpeg,視頻編解碼

1.UI設(shè)計(jì)

windows下使用FFmpeg開源庫進(jìn)行視頻編解碼完整步聚,FFMPEG,ffmpeg,視頻編解碼?2.在控件屬性窗口中輸入默認(rèn)值

windows下使用FFmpeg開源庫進(jìn)行視頻編解碼完整步聚,FFMPEG,ffmpeg,視頻編解碼

3.復(fù)制已編譯FFmpeg庫到工程同級目錄下

windows下使用FFmpeg開源庫進(jìn)行視頻編解碼完整步聚,FFMPEG,ffmpeg,視頻編解碼?4.在工程引用FFmpeg庫及頭文件

windows下使用FFmpeg開源庫進(jìn)行視頻編解碼完整步聚,FFMPEG,ffmpeg,視頻編解碼

windows下使用FFmpeg開源庫進(jìn)行視頻編解碼完整步聚,FFMPEG,ffmpeg,視頻編解碼?

5.鏈接指定FFmpeg庫

windows下使用FFmpeg開源庫進(jìn)行視頻編解碼完整步聚,FFMPEG,ffmpeg,視頻編解碼?

6.使用FFmpeg庫

引用頭文件?

extern "C"
{
#include "libswscale/swscale.h"
#include "libavdevice/avdevice.h"
#include "libavcodec/avcodec.h"
#include "libavcodec/bsf.h"
#include "libavformat/avformat.h"
#include "libavutil/avutil.h"
#include "libavutil/imgutils.h"
#include "libavutil/log.h"
#include "libavutil/imgutils.h"
#include "libavutil/time.h"
#include <libswresample/swresample.h>

}

創(chuàng)建視頻編解碼管理類?

windows下使用FFmpeg開源庫進(jìn)行視頻編解碼完整步聚,FFMPEG,ffmpeg,視頻編解碼

實(shí)現(xiàn)視頻編解碼管理類

#include "ffmpegmananger.h"
#include <QThread>
ffmpegMananger::ffmpegMananger(QObject *parent ):
    QObject(parent)
{
    m_pInFmtCtx = nullptr;
    m_pTsFmtCtx  = nullptr;
    m_qstrRtspURL = "";
    m_qstrOutPutFile = "";
}
ffmpegMananger::~ffmpegMananger()
{
    avformat_free_context(m_pInFmtCtx);
    avformat_free_context(m_pTsFmtCtx);
}

void ffmpegMananger::getRtspURL(QString strRtspURL)
{
    this->m_qstrRtspURL = strRtspURL;
}
void ffmpegMananger::getOutURL(QString strRute)
{
    this->m_qstrOutPutFile = strRute;
    printf("===========%s\n",m_qstrOutPutFile.toStdString().c_str());
}
void ffmpegMananger::setOutputCtx(AVCodecContext *encCtx, AVFormatContext **pTsFmtCtx,int &nVideoIdx_out)
{
    avformat_alloc_output_context2(pTsFmtCtx , nullptr, nullptr, m_qstrOutPutFile.toStdString().c_str());
    if (!pTsFmtCtx ) {
        printf("Could not create output context\n");
        return;
    }
    if (avio_open(&((*pTsFmtCtx)->pb), m_qstrOutPutFile.toStdString().c_str(), AVIO_FLAG_READ_WRITE) < 0)
    {
       avformat_free_context(*pTsFmtCtx);
       printf("avio_open fail.");
       return;
    }
    AVStream *out_stream = avformat_new_stream(*pTsFmtCtx, encCtx->codec);
    nVideoIdx_out = out_stream->index;
    //nVideoIdx_out = out_stream->index;
    avcodec_parameters_from_context(out_stream->codecpar, encCtx);
    printf("==========Output Information==========\n");
    av_dump_format(*pTsFmtCtx, 0, m_qstrOutPutFile.toStdString().c_str(), 1);
    printf("======================================\n");
}
int ffmpegMananger::ffmepgInput()
{
    int nRet = 0;
    AVCodecContext *encCtx = nullptr;//編碼器
    //const char *pUrl = "D:/videos/264.dat";
    std::string temp = m_qstrRtspURL.toStdString();
    const char *pUrl = temp.c_str();
    printf("===========%s\n",pUrl);
    AVDictionary *options = nullptr;
    av_dict_set(&options,"rtsp_transport", "tcp", 0);
    av_dict_set(&options,"stimeout","10000000",0);
    // 設(shè)置“buffer_size”緩存容量
    av_dict_set(&options, "buffer_size", "1024000", 0);
    nRet = avformat_open_input(&m_pInFmtCtx,pUrl,nullptr,&options);
    if( nRet < 0)
    {
        printf("Could not open input file,===========keep trying \n");
        return nRet;
    }
    avformat_find_stream_info(m_pInFmtCtx, nullptr);
    printf("===========Input Information==========\n");
    av_dump_format(m_pInFmtCtx, 0, pUrl, 0);
    printf("======================================\n");
    //1.獲取視頻流編號
    int nVideo_indx = av_find_best_stream(m_pInFmtCtx,AVMEDIA_TYPE_VIDEO,-1,-1,nullptr,0);
    if(nVideo_indx < 0)
    {
        avformat_free_context(m_pInFmtCtx);
        printf("查找解碼器失敗\n");
        return -1;
    }
    //2.查找解碼器
    AVCodec *pInCodec = avcodec_find_decoder(m_pInFmtCtx->streams[nVideo_indx]->codecpar->codec_id);
    if(nullptr == pInCodec)
    {
        printf("avcodec_find_decoder fail.");
        return -1;
    }
    //獲取解碼器上下文
    AVCodecContext* pInCodecCtx = avcodec_alloc_context3(pInCodec);
    //復(fù)制解碼器參數(shù)
    nRet = avcodec_parameters_to_context(pInCodecCtx, m_pInFmtCtx->streams[nVideo_indx]->codecpar);
    if(nRet < 0)
    {

        avcodec_free_context(&pInCodecCtx);
        printf("avcodec_parameters_to_context fail.");
        return -1;
    }
    //打開解碼器
    if(avcodec_open2(pInCodecCtx, pInCodec, nullptr) < 0)
    {
        avcodec_free_context(&pInCodecCtx);
        printf("Error: Can't open codec!\n");
        return -1;
    }
    printf("width = %d\n", pInCodecCtx->width);
    printf("height = %d\n", pInCodecCtx->height);
    int frame_index = 0;
    int got_picture = 0;
    AVStream *in_stream =nullptr;
    AVStream *out_stream =nullptr;
    AVFrame *pFrame= av_frame_alloc();
    AVPacket *newpkt = av_packet_alloc();
    AVPacket *packet = av_packet_alloc();
    av_init_packet(newpkt);
    av_init_packet(packet);
    // alloc AVFrame
    AVFrame*pFrameRGB = av_frame_alloc();
    // 圖像色彩空間轉(zhuǎn)換、分辨率縮放、前后圖像濾波處理
    SwsContext *m_SwsContext = sws_getContext(pInCodecCtx->width, pInCodecCtx->height,
            pInCodecCtx->pix_fmt, pInCodecCtx->width, pInCodecCtx->height,
            AV_PIX_FMT_RGB32, SWS_BICUBIC, nullptr, nullptr, nullptr);

    int bytes = av_image_get_buffer_size(AV_PIX_FMT_RGB32, pInCodecCtx->width, pInCodecCtx->height,4);
    uint8_t *m_OutBuffer = (uint8_t *)av_malloc(bytes * sizeof(uint8_t));

    // 將分配的內(nèi)存空間給pFrameRGB使用
    avpicture_fill((AVPicture *)pFrameRGB, m_OutBuffer, AV_PIX_FMT_RGB32, pInCodecCtx->width, pInCodecCtx->height);
    if(encCtx == nullptr)
    {
        //打開編碼器
        openEncoder(pInCodecCtx->width, pInCodecCtx->height,&encCtx);
    }
    int videoindex_out = 0;
    //設(shè)置輸出文件上下文
    setOutputCtx(encCtx,&m_pTsFmtCtx,videoindex_out);
    //Write file header
    if (avformat_write_header(m_pTsFmtCtx, nullptr) < 0)
    {
        avformat_free_context(m_pTsFmtCtx);
        printf("Error occurred when opening output file\n");
        return -1;
    }
    printf("==============writer trail===================.\n");
    int count = 0;
    nRet = 0;
    while(av_read_frame(m_pInFmtCtx, packet) >= 0)//從pInFmtCtx讀H264數(shù)據(jù)到packet;
    {
        if(packet->stream_index != nVideo_indx)//僅保留圖像
        {
            continue;
        }
        if(avcodec_send_packet(pInCodecCtx, packet)<0)//送packet中H264數(shù)據(jù)給解碼器碼器進(jìn)行解碼,解碼好的YUV數(shù)據(jù)放在pInCodecCtx,
        {
           break;
        }
        av_packet_unref(packet);
        got_picture = avcodec_receive_frame(pInCodecCtx, pFrame);//把解碼好的YUV數(shù)據(jù)放到pFrame中
        if(0 == got_picture)//解碼好一幀數(shù)據(jù)
        {
            //發(fā)送顯示圖像的信號
            // 對解碼視頻幀進(jìn)行縮放、格式轉(zhuǎn)換等操作
            sws_scale(m_SwsContext, (uint8_t const * const *)pFrame->data,
                     pFrame->linesize, 0, pInCodecCtx->height,
                     pFrameRGB->data, pFrameRGB->linesize);

            // 轉(zhuǎn)換到QImage
            QImage tmmImage((uchar *)m_OutBuffer, pInCodecCtx->width, pInCodecCtx->height, QImage::Format_RGB32);
            QImage image = tmmImage.copy();

            // 發(fā)送QImage
            emit Sig_GetOneFrame(image);

            setDecoderPts(newpkt->stream_index,count, pFrame);
            count++;
            //送原始數(shù)據(jù)給編碼器進(jìn)行編碼
            nRet = avcodec_send_frame(encCtx,pFrame);
            if(nRet < 0)
            {
                continue;
            }
            //從編碼器獲取編號的數(shù)據(jù)
            while(nRet >= 0)
            {
                nRet = avcodec_receive_packet(encCtx,newpkt);
                if(nRet < 0)
                {
                    break;
                }
                setEncoderPts(nVideo_indx,frame_index,videoindex_out,newpkt);
                int _count = 1;
                printf("Write %d Packet. size:%5d\tpts:%lld\n", _count,newpkt->size, newpkt->pts);

                if (av_interleaved_write_frame(m_pTsFmtCtx, newpkt) < 0)
                {
                    printf("Error muxing packet\n");
                    goto end;
                }
                _count++;
                av_packet_unref(newpkt);
            }
        }
    }
    while(1)//從pInFmtCtx讀H264數(shù)據(jù)到packet;
    {
        if(packet->stream_index != nVideo_indx)//僅保留圖像
        {
            continue;
        }
        if(avcodec_send_packet(pInCodecCtx, packet)<0)//送packet中H264數(shù)據(jù)給解碼器碼器進(jìn)行解碼,解碼好的YUV數(shù)據(jù)放在pInCodecCtx,
        {
            continue;
        }
        av_packet_unref(packet);
        got_picture = avcodec_receive_frame(pInCodecCtx, pFrame);//把解碼好的YUV數(shù)據(jù)放到pFrame中
        if(!got_picture)//解碼好一幀數(shù)據(jù)
        {
            AVRational in_time_base1 = in_stream->time_base;
            in_stream = m_pInFmtCtx->streams[newpkt->stream_index];

            //Duration between 2 frames (us)
            int64_t in_duration = (double)AV_TIME_BASE / av_q2d(in_stream->r_frame_rate);
            pFrame->pts = (double)(count*in_duration) / (double)(av_q2d(in_time_base1)*AV_TIME_BASE);
            count++;
            //送原始數(shù)據(jù)給編碼器進(jìn)行編碼
            nRet = avcodec_send_frame(encCtx,pFrame);
            if(nRet < 0)
            {
                break;
            }
            //從編碼器獲取編號的數(shù)據(jù)
            while(nRet >= 0)
            {
                nRet = avcodec_receive_packet(encCtx,newpkt);
                if(nRet < 0)
                {
                    continue;
                }
                in_stream = m_pInFmtCtx->streams[newpkt->stream_index];
                out_stream = m_pTsFmtCtx->streams[videoindex_out];
                if (newpkt->stream_index == nVideo_indx)
                {
                    //FIX:No PTS (Example: Raw H.264)
                    //Simple Write PTS
                    if (newpkt->pts == AV_NOPTS_VALUE)
                    {
                        //Write PTS
                        AVRational time_base1 = in_stream->time_base;
                        //Duration between 2 frames (us)
                        int64_t calc_duration = (double)AV_TIME_BASE / av_q2d(in_stream->r_frame_rate);
                        //Parameters
                        newpkt->pts = (double)(frame_index*calc_duration) / (double)(av_q2d(time_base1)*AV_TIME_BASE);
                        newpkt->dts = newpkt->pts;
                        newpkt->duration = (double)calc_duration / (double)(av_q2d(time_base1)*AV_TIME_BASE);
                        frame_index++;
                    }
                 }
                //Convert PTS/DTS
                newpkt->pts = av_rescale_q_rnd(newpkt->pts, in_stream->time_base, out_stream->time_base, (AVRounding)(AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX));
                newpkt->dts = av_rescale_q_rnd(newpkt->dts, in_stream->time_base, out_stream->time_base, (AVRounding)(AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX));
                newpkt->duration = av_rescale_q(newpkt->duration, in_stream->time_base, out_stream->time_base);
                newpkt->pos = -1;
                newpkt->stream_index = videoindex_out;
                int count = 1;
                printf("Write %d Packet. size:%5d\tpts:%lld\n", count,newpkt->size, newpkt->pts);

                if (av_interleaved_write_frame(m_pTsFmtCtx, newpkt) < 0)
                {
                    printf("Error muxing packet\n");
                    goto end;
                }
                count++;
                av_packet_unref(newpkt);
            }
        }
    }
    //Write file trailer
    av_write_trailer(m_pTsFmtCtx);
end:
    av_frame_free(&pFrame);
    av_frame_free(&pFrameRGB);
    av_packet_unref(newpkt);
    av_packet_unref(packet);
    std::cout<<"rtsp's h264 to ts end";  
    return  0;
}
void ffmpegMananger::setDecoderPts(int idx,int count,AVFrame *pFrame)
{
    AVStream* in_stream = m_pInFmtCtx->streams[idx];
    AVRational in_time_base1 = in_stream->time_base;
    //Duration between 2 frames (us)
    int64_t in_duration = (double)AV_TIME_BASE / av_q2d(in_stream->r_frame_rate);
    pFrame->pts = (double)(count*in_duration) / (double)(av_q2d(in_time_base1)*AV_TIME_BASE);
}
void ffmpegMananger::setEncoderPts(int nVideo_indx,int frame_index,int videoindex_out,AVPacket *newpkt)
{
    AVStream*in_stream = m_pInFmtCtx->streams[newpkt->stream_index];
    AVStream*out_stream = m_pTsFmtCtx->streams[videoindex_out];
    if (newpkt->stream_index == nVideo_indx)
    {
        //FIX:No PTS (Example: Raw H.264)
        //Simple Write PTS
        if (newpkt->pts == AV_NOPTS_VALUE)
        {
            //Write PTS
            AVRational time_base1 = in_stream->time_base;
            //Duration between 2 frames (us)
            int64_t calc_duration = (double)AV_TIME_BASE / av_q2d(in_stream->r_frame_rate);
            //Parameters
            newpkt->pts = (double)(frame_index*calc_duration) / (double)(av_q2d(time_base1)*AV_TIME_BASE);
            newpkt->dts = newpkt->pts;
            newpkt->duration = (double)calc_duration / (double)(av_q2d(time_base1)*AV_TIME_BASE);
            frame_index++;
        }
     }
    //Convert PTS/DTS
    newpkt->pts = av_rescale_q_rnd(newpkt->pts, in_stream->time_base, out_stream->time_base, (AVRounding)(AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX));
    newpkt->dts = av_rescale_q_rnd(newpkt->dts, in_stream->time_base, out_stream->time_base, (AVRounding)(AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX));
    newpkt->duration = av_rescale_q(newpkt->duration, in_stream->time_base, out_stream->time_base);
    newpkt->pos = -1;
    newpkt->stream_index = videoindex_out;
}
void ffmpegMananger::writeTail()
{
    //Write file trailer
    av_write_trailer(m_pTsFmtCtx);
}
void ffmpegMananger::openEncoder(int width, int height, AVCodecContext** enc_ctx)
{
    //使用libx264編碼器
    AVCodec * pCodec = avcodec_find_encoder_by_name("libx264");
    if(nullptr == pCodec)
    {
        printf("avcodec_find_encoder_by_name fail.\n");
        return;
    }
    //獲取編碼器上下文
    *enc_ctx = avcodec_alloc_context3(pCodec);
    if(nullptr == enc_ctx)
    {
        printf("avcodec_alloc_context3(pCodec) fail.\n");
        return;
    }
    //sps/pps
    (*enc_ctx)->profile = FF_PROFILE_H264_MAIN;
    (*enc_ctx)->level = 30;//表示level是5.0
    //分辨率
    (*enc_ctx)->width = width;
    (*enc_ctx)->height = height;
    //gop
    (*enc_ctx)->gop_size = 25;//i幀間隔
    (*enc_ctx)->keyint_min = 20;//設(shè)置最小自動(dòng)插入i幀的間隔.OPTION
    //B幀
    (*enc_ctx)->max_b_frames = 0;//不要B幀
    (*enc_ctx)->has_b_frames = 0;//
    //參考幀
    (*enc_ctx)->refs = 3;//OPTION
    //設(shè)置輸入的yuv格式
    (*enc_ctx)->pix_fmt = AV_PIX_FMT_YUV420P;
    //設(shè)置碼率
    (*enc_ctx)->bit_rate = 3000000;
    //設(shè)置幀率
    //(*enc_ctx)->time_base = (AVRational){1,25};//幀與幀之間的間隔
    (*enc_ctx)->time_base.num = 1;
    (*enc_ctx)->time_base.den = 25;
    //(*enc_ctx)->framerate = (AVRational){25,1};//幀率 25幀每秒
    (*enc_ctx)->framerate.num = 25;
    (*enc_ctx)->framerate.den = 1;
    if(avcodec_open2((*enc_ctx),pCodec,nullptr) < 0)
    {
        printf("avcodec_open2 fail.\n");
    }
    return;
}

?文章來源地址http://www.zghlxwxcb.cn/news/detail-717755.html

到了這里,關(guān)于windows下使用FFmpeg開源庫進(jìn)行視頻編解碼完整步聚的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • IOS工程使用OpenCV庫完整步聚

    IOS工程使用OpenCV庫完整步聚

    1.打開Xcode15并點(diǎn)擊Create New Project? ?2.引用編譯好的opencv2.framework框架 ?選擇添加其它庫 選擇Add Files ... 選擇OpenCV源碼編譯生成輸入的IOS平臺(tái)的opencv2.framework庫? opencv庫要放在工程目錄下,不然會(huì)找不到? 成功添加opencv庫的引用,現(xiàn)在可在工程中使用opencv庫的功能了

    2024年02月10日
    瀏覽(13)
  • 基于開源的Micro-RTSP,使用VLC和ffmpeg拉流播放RTSP視頻流,本例使用安信可ESP32 CAM進(jìn)行推流。

    基于開源的Micro-RTSP,使用VLC和ffmpeg拉流播放RTSP視頻流,本例使用安信可ESP32 CAM進(jìn)行推流。

    基于開源的Micro-RTSP,使用VLC和ffmpeg拉流播放RTSP視頻流,本例使用安信可ESP32 CAM進(jìn)行推流。 vlc播放命令為:rtsp://192.168.43.128:8554/mjpeg/1。 ffmpeg播放命令為:ffplay rtsp://192.168.43.128:8554/mjpeg/1。 使用ESP-IDF5.0編譯成功。esp-idf-v4.4.2編譯不成功,有成功的小伙伴可以分享一下。 git cl

    2024年02月01日
    瀏覽(40)
  • 13、ffmpeg使用nvidia顯卡對OAK深度相機(jī)進(jìn)行解碼和編碼

    基本思想:簡單使用nvidia的硬件解碼進(jìn)行oak相機(jī)的編碼和解碼學(xué)習(xí) 一、在本機(jī)rtx3060配置好顯卡驅(qū)動(dòng)和cuda之后進(jìn)行下面操作50、ubuntu18.0420.04+CUDA11.1+cudnn11.3+TensorRT7.2/8.6+Deepsteam5.1+vulkan環(huán)境搭建和YOLO5部署_ubuntu18.04安裝vulkan_sxj731533730的博客-CSDN博客 二、配置環(huán)境和編譯庫

    2024年02月16日
    瀏覽(22)
  • 【FFmpeg】ffmpeg 命令行參數(shù) ⑧ ( 使用 ffmpeg 轉(zhuǎn)換封裝格式 | 音視頻編解碼器參數(shù)設(shè)置 | 視頻 幀率 / 碼率 / 分辨率 設(shè)置 | 音頻 碼率 / 采樣率 設(shè)置 )

    【FFmpeg】ffmpeg 命令行參數(shù) ⑧ ( 使用 ffmpeg 轉(zhuǎn)換封裝格式 | 音視頻編解碼器參數(shù)設(shè)置 | 視頻 幀率 / 碼率 / 分辨率 設(shè)置 | 音頻 碼率 / 采樣率 設(shè)置 )

    音視頻 文件 從 采樣 - 處理 - 得到原始數(shù)據(jù)幀隊(duì)列 - 音視頻編碼 - 音視頻包隊(duì)列 - 格式封裝 的過程如下 : 封裝格式 參考 【音視頻原理】音視頻 “ 采樣 - 編碼 - 封裝 過程 “ 和 “ 解封裝 - 解碼 - 播放 過程 “ 分析 ( 視頻采集處理流程 | 音頻采集處理流程 | 音視頻文件解封裝

    2024年04月17日
    瀏覽(101)
  • windows環(huán)境下實(shí)現(xiàn)ffmpeg本地視頻進(jìn)行rtsp推流

    windows環(huán)境下實(shí)現(xiàn)ffmpeg本地視頻進(jìn)行rtsp推流

    摘要:有時(shí)候服務(wù)端(如linux)或者邊緣端(jetson盒子)需要接受攝像頭的視頻流輸入,而攝像頭的輸入視頻流一般為rtsp,測試時(shí)需要搭建攝像頭環(huán)境,很不方便,因此需要對本地視頻進(jìn)行rtsp推流,模擬攝像頭的rtsp輸入。 本地使用windows10, 64位 rtsp下載地址:https://github.com

    2024年04月13日
    瀏覽(23)
  • Windows 下融合使用開源組件進(jìn)行視頻內(nèi)容分析,shotcut ,autocut 剪輯 whisper智能化編輯雙語字幕等

    下面以這個(gè)黃仁勛訪談視頻為例簡要介紹分析的步驟 https://youtu.be/lXLBTBBil2U https://github.com/openai/whisper 提升: 安裝如果需要在conda 中使用 ffmpeg 的話,也是可以直接用 conda install ffmpeg https://github.com/openai/whisper/discussions/1172 We are thrilled to introduce Subper (https://subtitlewhisper.com), a f

    2024年04月09日
    瀏覽(39)
  • FFmpeg編解碼流程解讀--視頻解碼1

    FFmpeg編解碼流程解讀--視頻解碼1

    首先我們知道ffmpeg是一個(gè)開源的音視頻編解碼,封裝和解封裝的工具。具體的下載方式這里不多贅述(感興趣百度自行下載源碼)。這里主要將編解碼。ffmpeg音視頻編解碼依賴libavcodec。其為我們提供一套架構(gòu),其中包含了編解碼器。這里主要介紹我們常用的一些API接口去處理

    2023年04月08日
    瀏覽(15)
  • 使用ffmpeg進(jìn)行視頻截取

    使用ffmpeg進(jìn)行視頻截取

    通過ffmpeg -i命令查看視頻基本信息 指定截取視頻的 開始時(shí)間 和 結(jié)束時(shí)間 ,進(jìn)行視頻截取 或者: 指定截取視頻的 開始時(shí)間 和 截取的秒數(shù) ,進(jìn)行視頻截取 -i ./input.mp4? 指定輸入視頻路徑 -ss 00:00:10? 指定截取視頻的開始時(shí)間點(diǎn) -to 00:00:15? 指定截取視頻的結(jié)束時(shí)間點(diǎn) -t 5 指定

    2024年01月18日
    瀏覽(17)
  • FFmpeg之視頻解碼

    FFmpeg之視頻解碼

    第一次寫CSDN,先熟悉熟悉FFmpeg 常用結(jié)構(gòu)體 常用方法函數(shù) 視頻解碼的一些基礎(chǔ)知識: 視頻流是按一定的順序排列 I 幀, P 幀 和 B 幀的。 ? 因此,重要性:I 幀 P 幀 B 幀。由于不同類型的幀的重要性不同,這意味著我們要按播放連貫的視頻,就必須按照一定規(guī)定來顯示這些幀

    2023年04月08日
    瀏覽(20)
  • ffmpeg實(shí)現(xiàn)視頻解碼

    參考100行代碼實(shí)現(xiàn)最簡單的基于FFMPEG+SDL的視頻播放器(SDL1.x) 平臺(tái)環(huán)境:windows VS 2022 以及在 項(xiàng)目-項(xiàng)目屬性-鏈接器-命令行,在右側(cè)其他選項(xiàng)中添加“/SAFESEH:NO”,這樣就不會(huì)再報(bào)錯(cuò)了。 1.初始化FFmpeg庫: 在代碼中引入相關(guān)的FFmpeg頭文件,并調(diào)用初始化函數(shù)。例如: 2.打開輸

    2024年01月24日
    瀏覽(49)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包