【FFmpeg】支持flv+hevc编解码转码

背景

当前FFmpeg支持flv+h264的编解码和转码,但是并不支持flv+h265
如果需要在FFmpeg中支持flv+h265,只需要简单的修改代码

源码修改

flv.h

diff --git a/libavformat/flv.h b/libavformat/flv.h
index 3571b90..91f0065 100644
--- a/libavformat/flv.h
+++ b/libavformat/flv.h
@@ -110,6 +110,7 @@ enum {
     FLV_CODECID_H264    = 7,
     FLV_CODECID_REALH263= 8,
     FLV_CODECID_MPEG4   = 9,
+    FLV_CODECID_HEVC    = 12,
 };
 
 enum {

flvenc.c

diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index 1cfcdc6..9eed7c5 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -27,6 +27,7 @@
 #include "avio_internal.h"
 #include "avio.h"
 #include "avc.h"
+#include "hevc.h"
 #include "avformat.h"
 #include "flv.h"
 #include "internal.h"
@@ -46,6 +47,7 @@ static const AVCodecTag flv_video_codec_ids[] = {
     { AV_CODEC_ID_VP6,      FLV_CODECID_VP6 },
     { AV_CODEC_ID_VP6A,     FLV_CODECID_VP6A },
     { AV_CODEC_ID_H264,     FLV_CODECID_H264 },
+    { AV_CODEC_ID_HEVC,     FLV_CODECID_HEVC },
     { AV_CODEC_ID_NONE,     0 }
 };
 
@@ -479,9 +481,9 @@ static int unsupported_codec(AVFormatContext *s,
 {
     const AVCodecDescriptor *desc = avcodec_descriptor_get(codec_id);
     av_log(s, AV_LOG_ERROR,
-           "%s codec %s not compatible with flv\n",
+           "here %s codec %s not compatible with flv %d\n",
             type,
-            desc ? desc->name : "unknown");
+            desc ? desc->name : "unknown", codec_id);
     return AVERROR(ENOSYS);
 }
 
@@ -490,7 +492,7 @@ static void flv_write_codec_header(AVFormatContext* s, AVCodecParameters* par, i
 
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值