博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ffmpeg时间戳精准定位
阅读量:4200 次
发布时间:2019-05-26

本文共 2652 字,大约阅读时间需要 8 分钟。

背景

ffmpeg 在转码 -ss accurate_seek 参数分析,是否可以精准的seek视频流。

构建测试素材

重新编码片源,设置片源gop间隔为10秒,帧率30fps,同时为每帧图像添加时间戳水印,素材时长为5分钟

转码命令:
ffmpeg -t 5:00 -i input.mp4 -vf “drawtext=fontsize=120:text=’%{pts:hms}’” -c:v libx264 -r 30 -g 300 -s 1280x720 -preset veryfast -crf 23 -an -f mp4 test.mp4 -y

ffmpeg -t 5:00 -i input.mp4 -vf "drawtext=fontsize=120:text='%{pts\:hms}'"  -c:v libx264 -r 30 -g 300 -s 1280x720 -preset veryfast -crf 23 -an -f mp4 test.mp4 -y

校验:

ffprobe -i test.mp4 -of compact -show_frames -show_entries frame=key_frame,pkt_pts_time,pict_type,coded_picture_number | grep pict_type=I

ffprobe -i test.mp4 -of compact -show_frames -show_entries frame=key_frame,pkt_pts_time,pict_type,coded_picture_number  | grep pict_type=I

查看关键帧信息

frame|key_frame=1|pkt_pts_time=0.000000|pict_type=I|coded_picture_number=0frame|key_frame=1|pkt_pts_time=3.766667|pict_type=I|coded_picture_number=113frame|key_frame=1|pkt_pts_time=13.433333|pict_type=I|coded_picture_number=403frame|key_frame=1|pkt_pts_time=20.433333|pict_type=I|coded_picture_number=613frame|key_frame=1|pkt_pts_time=29.033333|pict_type=I|coded_picture_number=871frame|key_frame=1|pkt_pts_time=35.466667|pict_type=I|coded_picture_number=1064frame|key_frame=1|pkt_pts_time=42.166667|pict_type=I|coded_picture_number=1265frame|key_frame=1|pkt_pts_time=47.866667|pict_type=I|coded_picture_number=1436frame|key_frame=1|pkt_pts_time=53.700000|pict_type=I|coded_picture_number=1611frame|key_frame=1|pkt_pts_time=63.700000|pict_type=I|coded_picture_number=1911frame|key_frame=1|pkt_pts_time=67.500000|pict_type=I|coded_picture_number=2025frame|key_frame=1|pkt_pts_time=77.500000|pict_type=I|coded_picture_number=2325frame|key_frame=1|pkt_pts_time=87.200000|pict_type=I|coded_picture_number=2616frame|key_frame=1|pkt_pts_time=96.433333|pict_type=I|coded_picture_number=2893frame|key_frame=1|pkt_pts_time=101.666667|pict_type=I|coded_picture_number=3050frame|key_frame=1|pkt_pts_time=107.300000|pict_type=I|coded_picture_number=3219frame|key_frame=1|pkt_pts_time=114.466667|pict_type=I|coded_picture_number=3434frame|key_frame=1|pkt_pts_time=120.633333|pict_type=I|coded_picture_number=3619frame|key_frame=1|pkt_pts_time=130.633333|pict_type=I|coded_picture_number=3919frame|key_frame=1|pkt_pts_time=137.400000|pict_type=I|coded_picture_number=4122frame|key_frame=1|pkt_pts_time=142.666667|pict_type=I|coded_picture_number=4280frame|key_frame=1|pkt_pts_time=150.100000|pict_type=I|coded_picture_number=4503

测试

time ffmpeg  -ss 145 -i test.mp4 -vframes 1 test.jpg -y; open test.jpgtime ffmpeg -accurate_seek -i test.mp4 -ss 145 -vframes 1 test.jpg -y; open test.jpg

感兴趣可以试试

参考:

https://trac.ffmpeg.org/wiki/Seeking

转载地址:http://nqfli.baihongyu.com/

你可能感兴趣的文章
C# 检查字符串,防SQL注入攻击
查看>>
关于对SQL注入80004005 及其它错误消息分析
查看>>
即时通软件性能测试(与宴宾的对话)
查看>>
应用软件性能测试的艺术(翻译)——序
查看>>
高级性能测试(翻译)
查看>>
Web安全测试解决方案
查看>>
今天开始上班
查看>>
开源测试研究方案泡汤了
查看>>
晒一下我培训的课程——应用系统性能测试规划、实施与分析
查看>>
自动化测试框架之控制界面的关键
查看>>
自动化测试框架指南
查看>>
利用 STAF 实现程序更新包的自动部署测试
查看>>
软件安全性测试转载自小龙虾博客
查看>>
周末参加“北京干部管理职业技术学院”关于高职课程改革的专家讨论会
查看>>
软件测试框架介绍
查看>>
软件自动化测试框架的发展
查看>>
nginx反向代理的缓存
查看>>
基于Keepalived+Haproxy+Varnish+LNMP企业级架构
查看>>
实现haproxy+LNMT负载均衡架构
查看>>
常感冒的小朋友的应对
查看>>