live555 场编码H264 帧率异常问题
2016-09-20 21:34
411 查看
最近在折腾live555 RTSP服务器,遇到一个码流帧率异常问题:用vlc客户端rtsp取流播放的时候 感觉像 慢放;
用elecard分析了码流,发现是场编码,帧率是25fps; 而帧编码的码流用vlc 取流播放 并没有发现异常;
单步调试live555源码后 发现live555框架 解析 场编码码流帧率 并没有出错,也是解析成25fps;
尝试修改解析代码,若解析出来是场编码H264,则把帧率=(码流帧率*2),:
1. 找到 frame_mbs_only_flag 标志位,该标志位是标识 H264是否为场编码;
frame_mbs_only_flag = true 表示帧编码; frame_mbs_only_flag = true 表示场编码;
2. 在sps解析代码中增加 场编码判定及帧率修改
else if (isSPS(nal_unit_type)) { // Sequence parameter set
// First, save a copy of this NAL unit, in case the downstream object wants to see it:
usingSource()->saveCopyOfSPS(fStartOfFrame + fOutputStartCodeSize, curFrameSize() - fOutputStartCodeSize);
if (fParsedFrameRate == 0.0) {
// We haven't yet parsed a frame rate from the stream.
// So parse this NAL unit to check whether frame rate information is present:
unsigned num_units_in_tick, time_scale;
analyze_seq_parameter_set_data(num_units_in_tick, time_scale);
if (time_scale > 0 && num_units_in_tick > 0) {
usingSource()->fFrameRate = fParsedFrameRate
= time_scale/(DeltaTfiDivisor*num_units_in_tick);
//场编码
if (!fframe_mbs_only_flag)
{
usingSource()->fFrameRate = fParsedFrameRate = fParsedFrameRate * 2;
}
}
用elecard分析了码流,发现是场编码,帧率是25fps; 而帧编码的码流用vlc 取流播放 并没有发现异常;
单步调试live555源码后 发现live555框架 解析 场编码码流帧率 并没有出错,也是解析成25fps;
尝试修改解析代码,若解析出来是场编码H264,则把帧率=(码流帧率*2),:
1. 找到 frame_mbs_only_flag 标志位,该标志位是标识 H264是否为场编码;
frame_mbs_only_flag = true 表示帧编码; frame_mbs_only_flag = true 表示场编码;
2. 在sps解析代码中增加 场编码判定及帧率修改
else if (isSPS(nal_unit_type)) { // Sequence parameter set
// First, save a copy of this NAL unit, in case the downstream object wants to see it:
usingSource()->saveCopyOfSPS(fStartOfFrame + fOutputStartCodeSize, curFrameSize() - fOutputStartCodeSize);
if (fParsedFrameRate == 0.0) {
// We haven't yet parsed a frame rate from the stream.
// So parse this NAL unit to check whether frame rate information is present:
unsigned num_units_in_tick, time_scale;
analyze_seq_parameter_set_data(num_units_in_tick, time_scale);
if (time_scale > 0 && num_units_in_tick > 0) {
usingSource()->fFrameRate = fParsedFrameRate
= time_scale/(DeltaTfiDivisor*num_units_in_tick);
//场编码
if (!fframe_mbs_only_flag)
{
usingSource()->fFrameRate = fParsedFrameRate = fParsedFrameRate * 2;
}
}
相关文章推荐
- live555服务器 h264实时流丢包问题
- 事务、异常-T-SQL 编码时应该注意的10个问题-by小雨
- ffmpeg关于h264编码提示h264_mp4toannexb的问题
- live555 在网络异常断开后卡死的问题
- 解决mysql插入数据时出现Incorrect string value: '\xF0\x9F...' for column 'name' at row 1的异常 这个问题,原因是UTF-8编码有可
- linphone-解决3.2.5版本在Android5.0以前的系统没有H264编码的问题
- live555服务器 h264实时流丢包问题
- 嵌入式linux------ffmpeg移植 编码H264(am335x编码H264) 分类: TI-AM335X ffmpeg-SDL-VLC-Live555 arm-linux-Ubuntu 2015-08-04 09:34 5人阅读 评论(0) 收藏
- ffmpeg 编码h264 profile如何设置为baseline的问题
- Webrt中H264编码相关问题
- [Java]一个TCP文本上传相关的异常处理和偶然引出的中文编码问题
- ffmpeg 编码h264 profile如何设置为baseline的问题
- FFMPEG:压缩之H264编码(YUV420P->H264) 分类: DirectX ffmpeg-SDL-VLC-Live555 2014-11-26 14:31 997人阅读 评论(0) 收藏
- ffmpeg+x264编码mp4格式的视频出现视频帧率很大,导致视频无法播放的问题
- Utf-8+Bom编码导致的读取数据部分异常问题
- 关于H264编码的问题
- python中文编码问题深入分析(二):print打印中文异常及显示乱码问题分析与解决
- ffmpeg 编码h264 profile如何设置为baseline的问题
- MediaCodec 编码H264 编码一帧后dequeueOutputBuffer为-1的问题
- live555组播H264及sps和pps的问题