其他分享
首页 > 其他分享> > 利用ffmpeg 转码hevc到h264 ,以及 保存h265 h264流

利用ffmpeg 转码hevc到h264 ,以及 保存h265 h264流

作者:互联网

下载ffmpeg,并且将libx264编译进去

1.下载gas-preprocessor文件

2. 下载x264源码:

3. 下载x264编译脚本:

4. 将源码与脚本放在一起

5. 修改权限、执行脚本

编译FFmpeg + x264

1. 下载FFmpeg 编译脚本:

2. 编译FFmpeg

创建转码项目Test264

1. 创建fftools,命令行方式


cmdutils_common_opts.h

cmdutils.c

cmdutils.h

config.h

ffmpeg_filter.c

ffmpeg_opt.c

ffmpeg_videotoolbox.c

ffmpeg.c

ffmpeg.h

ffprobe.c

`

int exit_program(int ret)

{

//    if (program_exit)

//        program_exit(ret);

//

//    exit(ret);

return ret;
}

`

`

nb_filtergraphs=0;

nb_output_files=0;

nb_output_streams=0;

nb_input_files=0;

nb_input_streams=0;


term_exit();

ffmpeg_exited = 1;

`


AudioToolbox.framework

CoreMedia.framework

VideoToolbox.framework

libiconv.tdb

libbz2.tdb

libz.tdb

2. 使用代码转码

`

if (dec_ctx->codec_type == AVMEDIA_TYPE_VIDEO) {

            encoder = avcodec_find_encoder(AV_CODEC_ID_H264); //视频强制为h264
	
        }
    
        else{
    
            encoder = avcodec_find_encoder(AV_CODEC_ID_AAC); //声波转为aac
	
        }

`

`

		   enc_ctx->me_range = 16; 
	  
           enc_ctx->max_qdiff = 4;
       
           enc_ctx->qmin = 10; 
       
           enc_ctx->qmax = 51; 
      
           enc_ctx->qcompress = 0.6;

`

3. h265编码


源代码地址: https://github.com/Noying/transcode_hevc2h264


标签:hevc,ffmpeg,h264,ctx,编译,文件夹,exit,x264
来源: https://www.cnblogs.com/RoysPhoneBlog/p/13261895.html