資源簡介
ffmpeg提取mp4關鍵幀保存為jpg.zip
代碼片段和文件信息
/*
?*?Copyright?(c)?2012?Stefano?Sabatini
?*
?*?Permission?is?hereby?granted?free?of?charge?to?any?person?obtaining?a?copy
?*?of?this?software?and?associated?documentation?files?(the?“Software“)?to?deal
?*?in?the?Software?without?restriction?including?without?limitation?the?rights
?*?to?use?copy?modify?merge?publish?distribute?sublicense?and/or?sell
?*?copies?of?the?Software?and?to?permit?persons?to?whom?the?Software?is
?*?furnished?to?do?so?subject?to?the?following?conditions:
?*
?*?The?above?copyright?notice?and?this?permission?notice?shall?be?included?in
?*?all?copies?or?substantial?portions?of?the?Software.
?*
?*?THE?SOFTWARE?IS?PROVIDED?“AS?IS“?WITHOUT?WARRANTY?OF?ANY?KIND?EXPRESS?OR
?*?IMPLIED?INCLUDING?BUT?NOT?LIMITED?TO?THE?WARRANTIES?OF?MERCHANTABILITY
?*?FITNESS?FOR?A?PARTICULAR?PURPOSE?AND?NONINFRINGEMENT.?IN?NO?EVENT?SHALL
?*?THE?AUTHORS?OR?COPYRIGHT?HOLDERS?BE?LIABLE?FOR?ANY?CLAIM?DAMAGES?OR?OTHER
?*?LIABILITY?WHETHER?IN?AN?ACTION?OF?CONTRACT?TORT?OR?OTHERWISE?ARISING?FROM
?*?OUT?OF?OR?IN?CONNECTION?WITH?THE?SOFTWARE?OR?THE?USE?OR?OTHER?DEALINGS?IN
?*?THE?SOFTWARE.
?*/
/**
?*?@file
?*?Demuxing?and?decoding?example.
?*
?*?Show?how?to?use?the?libavformat?and?libavcodec?API?to?demux?and
?*?decode?audio?and?video?data.
?*?@example?demuxing_decoding.c
?*/
#include?
#include?
#include?
#include?
static?AVFormatContext?*fmt_ctx?=?NULL;
static?AVCodecContext?*video_dec_ctx?=?NULL?*audio_dec_ctx;
static?int?width?height;
static?enum?AVPixelFormat?pix_fmt;
static?AVStream?*video_stream?=?NULL?*audio_stream?=?NULL;
static?const?char?*src_filename?=?NULL;
static?char?video_dst_filename[50]?=?{0};
static?char?audio_dst_filename[50]?=?{0};
static?char?*dst_pathname?=?NULL;
static?FILE?*video_dst_file?=?NULL;
static?FILE?*audio_dst_file?=?NULL;
static?FILE?*video_dst_filetemp?=?NULL;
static?uint8_t?*video_dst_data[4]?=?{NULL};
static?int??????video_dst_linesize[4];
static?int?video_dst_bufsize;
static?int?video_stream_idx?=?-1?audio_stream_idx?=?-1;
static?AVframe?*frame?=?NULL;
static?AVPacket?pkt;
static?int?video_frame_count?=?0;
static?int?audio_frame_count?=?0;
static?AVCodecContext*?pCodecCtx?=?NULL;??
static?AVCodec*?pCodec?=?NULL;??
static?AVPacket?pkt_out;
static?char?file_name[50]?=?{0};
/*?Enable?or?disable?frame?reference?counting.?You?are?not?supposed?to?support
?*?both?paths?in?your?application?but?pick?the?one?most?appropriate?to?your
?*?needs.?Look?for?the?use?of?refcount?in?this?example?to?see?what?are?the
?*?differences?of?API?usage?between?them.?*/
static?int?refcount?=?0;
static?void??save_picture_uinit(FILE?*?pFileAVPacket?pkt)
{
fwrite(pkt.data?sizeof(uint8_t)pkt.size?pFile);
fclose(pFile);
pFile?=?NULL;
av_free_packet(&pkt);
}
void?generate_file_name(char?*?file_namechar?*?file_pathlong?long?pts)
{
if?(file_path[strlen(file_path)?-?1]?==?‘\\‘)
{
sprintf(file_name“%s%lld.jpg“file_pathpt
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2016-12-25?12:35??ffmpeghello4\
?????目錄???????????0??2016-12-25?12:20??ffmpeghello4\Debug\
?????文件????24519168??2016-12-16?20:17??ffmpeghello4\Debug\avcodec-57.dll
?????文件?????2008576??2016-12-16?20:17??ffmpeghello4\Debug\avdevice-57.dll
?????文件?????4207616??2016-12-16?20:17??ffmpeghello4\Debug\avfilter-6.dll
?????文件?????4942336??2016-12-16?20:17??ffmpeghello4\Debug\avformat-57.dll
?????文件??????662016??2016-12-16?20:17??ffmpeghello4\Debug\avutil-55.dll
?????文件???????37888??2016-12-25?12:20??ffmpeghello4\Debug\ffmpeghello4.exe
?????文件??????378432??2016-12-25?12:20??ffmpeghello4\Debug\ffmpeghello4.ilk
?????文件??????445440??2016-12-25?12:20??ffmpeghello4\Debug\ffmpeghello4.pdb
?????文件??????110592??2016-12-16?20:17??ffmpeghello4\Debug\postproc-54.dll
?????文件??????292864??2016-12-16?20:17??ffmpeghello4\Debug\swresample-2.dll
?????文件??????512000??2016-12-16?20:17??ffmpeghello4\Debug\swscale-4.dll
?????目錄???????????0??2016-12-22?11:51??ffmpeghello4\ffmpeghello4\
?????文件?????5263360??2016-12-25?12:35??ffmpeghello4\ffmpeghello4.sdf
?????文件?????????903??2016-12-22?11:47??ffmpeghello4\ffmpeghello4.sln
?????文件???????28672??2016-12-25?12:35??ffmpeghello4\ffmpeghello4.suo
?????目錄???????????0??2016-12-25?12:20??ffmpeghello4\ffmpeghello4\Debug\
?????文件?????????728??2016-12-25?12:20??ffmpeghello4\ffmpeghello4\Debug\cl.command.1.tlog
?????文件????????6936??2016-12-25?12:20??ffmpeghello4\ffmpeghello4\Debug\CL.read.1.tlog
?????文件?????????588??2016-12-25?12:20??ffmpeghello4\ffmpeghello4\Debug\CL.write.1.tlog
?????文件?????????635??2016-12-22?14:36??ffmpeghello4\ffmpeghello4\Debug\ffmpeghello4.Build.CppClean.log
?????文件?????????381??2016-12-25?12:20??ffmpeghello4\ffmpeghello4\Debug\ffmpeghello4.exe.intermediate.manifest
?????文件??????????97??2016-12-25?12:20??ffmpeghello4\ffmpeghello4\Debug\ffmpeghello4.lastbuildstate
?????文件????????8015??2016-12-25?12:20??ffmpeghello4\ffmpeghello4\Debug\ffmpeghello4.log
?????文件?????????713??2016-12-22?14:55??ffmpeghello4\ffmpeghello4\Debug\ffmpeghello4.vcxprojResolveAssemblyReference.cache
?????文件???????????0??2016-12-22?14:36??ffmpeghello4\ffmpeghello4\Debug\ffmpeghello4.write.1.tlog
?????文件????????1728??2016-12-25?12:20??ffmpeghello4\ffmpeghello4\Debug\li
?????文件????????3956??2016-12-25?12:20??ffmpeghello4\ffmpeghello4\Debug\li
?????文件????????1024??2016-12-25?12:20??ffmpeghello4\ffmpeghello4\Debug\li
?????文件???????39582??2016-12-25?12:20??ffmpeghello4\ffmpeghello4\Debug\Main.obj
............此處省略12個文件信息
- 上一篇:mp4_play.zip
- 下一篇:28g超大字典
評論
共有 條評論