问题:

由于JSVM软件问题,导致编码的264文件在用DASH-SVC-toolchain在切割DASH流Segment的时候会报警告。

在DASH-SVC-toolchain的demultiplex.py文件中有这样的说明:

SVC编码软件JSVM跳过帧数问题警告的分析

 

也就是jsvm编码的264码流的第二个I帧在错误的位置,之前写过一个自动化切割脚本,从跳过帧数0开始搜索,直到不报错后保存不报错的切割DASH流。但是发现不同的视频有不同的跳过帧数,有的视频可能没有完全无警告的跳过帧数。

关键问题在于jsvm对“帧的设置”。

背景知识

一部视频中一般会有I、B、P这三类帧,起到一定的压缩左右

  1. I帧指的是intra picture,仅采用帧内压缩,可以独立解码的帧,所以压缩效率最低
  2. P帧指的是前向预测编码帧,由前面的P帧或者I帧预测而来,解码必须参照前面的帧,所以压缩效率较高
  3. B帧指的是双向预测编码帧,它根据相邻的前一帧、本帧以及后一帧数据的不同点来压缩本帧,也即仅记录本帧与前后帧的差值。所以压缩效率最高

 

JSVM参数分析

视频参数配置文件中的

Intraperiod 指的是I帧间隔

IntraPeriod

Unsigned Int, default: 2^32-1 (equal to 1)

Specifies the intra period for the encoded video sequence. When IntraPeriod is equal to –1 (2^32-1), only the very first picture is intra coded. Otherwise, every IntraPeriod picture (at the frame rate FrameRate) is intra-coded. The parameter IntraPeriod shall be equal to –1 or equal to a multiple of GOPSize.

 

Gopsize是一组B帧和P帧的长度

GOPSize

Unsigned Int, default: 1

Specifies the GOP size that shall be used for encoding a video sequence. A GOP (group of pictures) consists of a key picture, which is generally coded as P picture, and several hierarchically coded B pictures that are located between the key pictures. The parameter GOPSize must be equal to a power of 2. The GOP size is specified at the frame rate given by FrameRate. Thus, depending on the value of FrameRateOut in the layer configuration file, the actual GOP size for a layer might be smaller. For example, if FrameRate is equal to 30, GOPSize is equal to 16, and FrameRateOut is equal to 7.5, the actual GOP size that is employed for encoding the specific layer is equal to 4. The GOP size of all layers is selected in a way that the key pictures for all layers are temporally aligned. Hence, depending on the parameters FrameRateOut in the layer configuration files, the allowed range for GOPSize might be restricted. The maximum allowed value is 64.

 

 

 

 

 

FFmpeg参数分析

参数设置:(fps=30为例)

FFmpeg视频处理:

./ffmpeg -i $video_name -g $segment_period -bf 0 temp.mp4

 

FFmpeg里的GOP和JSVM里的GOP略有不同,提供的设置如下:

  1. -g 设置GOP大小(经测试,这里的GOP指的是I帧间隔)
  2. -bf 设置连续出现B帧的数量

 

设置举例:

-g:4

-bf:2

IBBPIBBPIBBPIBBPIBBP

 

-g:13

-bf:3

IBBBPBBBPBBBPIBBBPBBBPBBBP

 

 

目前问题及解决方案

JSVM的IDR帧位置经常出错,导致DASH-SVC-Toolchain切割码流报警告,而且没有规律,而且GOPsize无法从视频文件中读取。只有IDR帧在Segment的最开始位置才能保证独立解码。所以编码好的DASH流若想独立解码,帧的位置问题一定要注意!

虽然无法读取GOPsize,但可以尝试取消B帧(GOPsize=1),让视频中只存在I帧和P帧,这样的坏处是会让比特率增加,但是我发现此时对码流进行切割无需跳过任何帧数,目前切割的视频都没有任何错误,且没跳过任何帧。

 

 

JSVM配置文件:

视频信息文件

IntraPeriod             60              # Intra Period

GOPSize                1          # GOP Size (at maximum frame rate)

 

层次配置文件

IDRPeriod           60

 

脚本设计

写了一个批量SVC编码的脚本,截止目前已经编码好50部视频,跳过帧数为0且不出现任何警告。

运行截图 

SVC编码软件JSVM跳过帧数问题警告的分析

 

 

欢迎SVC编码研究者探讨和交流~ 

相关文章:

  • 2021-05-02
  • 2021-11-18
  • 2022-12-23
  • 2022-01-19
  • 2021-09-01
  • 2022-12-23
猜你喜欢
  • 2021-11-19
  • 2021-09-08
  • 2022-12-23
  • 2021-12-20
  • 2021-04-05
  • 2022-12-23
  • 2021-06-28
相关资源
相似解决方案