91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 2.68MB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2024-01-28
  • 語言: 其他
  • 標簽: ffmpeg??

資源簡介

利用FFmpeg將mkv視頻轉換為H.264,轉換后的視頻請用VLC播放。

資源截圖

代碼片段和文件信息

//?FFMepg_to_mp4.cpp?:?定義控制臺應用程序的入口點。
//

#include?“stdafx.h“
extern?“C“
{
#include?“libavcodec/avcodec.h“
#include?“libavformat/avformat.h“
#include?“libswscale/swscale.h“
#include?
#include?
#include?“libavutil/pixdesc.h“
}
const?char*?SRC_FILE?=?“Titanic.mkv“;
const?char*?OUT_FILE?=?“Titanic.h264“;
const?char*?OUT_FMT_FILE?=?“Titanic.mp4“;
int?_tmain(int?argc?_TCHAR*?argv[])
{
av_register_all();
AVFormatContext*?pFormat?=?NULL;
if?(avformat_open_input(&pFormat?SRC_FILE?NULL?NULL)? {
return?0;
}
AVCodecContext*?video_dec_ctx?=?NULL;
AVCodec*?video_dec?=?NULL;
if?(avformat_find_stream_info(pFormat?NULL)? {
return?0;
}
av_dump_format(pFormat?0?SRC_FILE?0);
video_dec_ctx?=?pFormat->streams[0]->codec;
video_dec?=?avcodec_find_decoder(video_dec_ctx->codec_id);
if?(avcodec_open2(video_dec_ctx?video_dec?NULL)? {
return?0;
}

AVFormatContext*?pOFormat?=?NULL;
AVOutputFormat*?ofmt?=?NULL;
if?(avformat_alloc_output_context2(&pOFormat?NULL?NULL?OUT_FILE)? {
return?0;
}
ofmt?=?pOFormat->oformat;
if?(avio_open(&(pOFormat->pb)?OUT_FILE?AVIO_FLAG_READ_WRITE)? {
return?0;
}
AVCodecContext?*video_enc_ctx?=?NULL;
AVCodec?*video_enc?=?NULL;
video_enc?=?avcodec_find_encoder(AV_CODEC_ID_H264);
AVStream?*video_st?=?avformat_new_stream(pOFormat?video_enc);
if?(!video_st)
return?0;
video_enc_ctx?=?video_st->codec;
video_enc_ctx->width?=?video_dec_ctx->width;
video_enc_ctx->height?=?video_dec_ctx->height;
video_enc_ctx->pix_fmt?=?AV_PIX_FMT_YUV420P;
video_enc_ctx->time_base.num?=?1;
video_enc_ctx->time_base.den?=?25;
video_enc_ctx->bit_rate?=?video_dec_ctx->bit_rate;
video_enc_ctx->gop_size?=?250;
video_enc_ctx->max_b_frames?=?10;

video_enc_ctx->qmin?=?10;
video_enc_ctx->qmax?=?51;
if?(avcodec_open2(video_enc_ctx?video_enc?NULL)? {
printf(“編碼器打開失敗!\n“);
return?0;
}
printf(“Output264video?Information====================\n“);
av_dump_format(pOFormat?0?OUT_FILE?1);
printf(“Output264video?Information====================\n“);

//mp4?file
AVFormatContext*?pMp4Format?=?NULL;
AVOutputFormat*?pMp4OFormat?=?NULL;
if?(avformat_alloc_output_context2(&pMp4Format?NULL?NULL?OUT_FMT_FILE)? {
return?0;
}
pMp4OFormat?=?pMp4Format->oformat;
if?(avio_open(&(pMp4Format->pb)?OUT_FMT_FILE?AVIO_FLAG_READ_WRITE)? {
return?0;
}
for?(int?i?=?0;?i?nb_streams;?i++)?{
AVStream?*in_stream?=?pFormat->streams[i];
AVStream?*out_stream?=?avformat_new_stream(pMp4Format?in_stream->codec->codec);
if?(!out_stream)?{
return?0;
}
int?ret?=?0;
ret?=?avcodec_copy_context(out_stream->codec?in_stream->codec);
if?(ret? fprintf(stderr?“Failed?to?copy?context?from?input?to?output?stream?codec?context\n“);
return?0;
}
out_stream->codec->codec_tag?=?0;
if?(pMp4Format->oformat->flags?&?AVFMT_GLOBALHEADER)

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????5831??2016-06-25?15:25??FFMepg_to_mp4.cpp
?????文件????????5238??2016-06-25?15:31??FFMepg_to_mp4.vcxproj
?????文件????????1320??2016-06-25?08:25??FFMepg_to_mp4.vcxproj.filters
?????文件????????1552??2016-06-25?08:25??ReadMe.txt
?????文件?????????219??2016-06-25?08:25??stdafx.cpp
?????文件?????????234??2016-06-25?08:25??stdafx.h
?????文件?????????236??2016-06-25?08:25??targetver.h
?????文件?????2834432??2015-07-15?16:19??Titanic.mkv

評論

共有 條評論