网站开发团队简介如何写,网站代码免费的,百度制作企业网站多少钱,网站开发需要多久最近遇到要识别隔行扫描的视频加以特殊转码处理的问题。google了一番以后找到两个解决的方式#xff0c;记录一下。方法一#xff1a;使用隔行扫描检查滤镜idet区分隔行扫描和逐行扫描ffmpeg -filter:v idet \ -frames:v 100 \ -an \ -f rawvideo -y /dev/null \ -i 351.mp4 …最近遇到要识别隔行扫描的视频加以特殊转码处理的问题。google了一番以后找到两个解决的方式记录一下。方法一使用隔行扫描检查滤镜idet区分隔行扫描和逐行扫描ffmpeg -filter:v idet \ -frames:v 100 \ -an \ -f rawvideo -y /dev/null \ -i 351.mp4 # Example output (this is not interlaced): # [Parsed_idet_0 0x1bcf720] Single frame detection:TFF:0 BFF:0 Progressive:564 Undetermined:84 # [Parsed_idet_0 0x1bcf720] Multi frame detection:TFF:0 BFF:0 Progressive:623 Undetermined:25 # flags: # -an discard audio, we dont need it # -f rawvideo output raw video # -y /dev/null discard the output # -i ... the input file to check # -frames:v 100 extract the first 100 frames # -filter:v idet insert the idet filter, which will output whether it has detected interlaced frames 如果结果中TFF和BFF非常多的话那就意味着视频是隔行扫描的如果都是Progressive的话就是逐行扫描的。关于TFF、BFF、Progressive三个参数FFmpeg的帮助文档里有相关的说明(这个正是方法二里面要用到的)interlaced mode (P for progressive, T for top field first, B for bottom field first)TFFtop field first 上场(奇数场)优先BFFbottom field first 下场(偶数场)优先具体可以参考这篇英文文章方法二使用查看视频帧详细信息的showinfo滤镜区分隔行扫描和逐行扫描ffmpeg -y -i 351.mp4 -vf showinfo -frames:v 2 -f flv /dev/null[Parsed_showinfo_0 0xf675c0] n:0 pts:0 pts_time:0 pos:324675 fmt:yuv420p sar:1/1 s:1280x720 i:P iskey:1 type:I checksum:A5217CD1 plane_checksum:[308C60A8 4FA1B85C A41363BE][Parsed_showinfo_0 0xf675c0] n:1 pts:1200 pts_time:0.04 pos:370498 fmt:yuv420p sar:1/1 s:1280x720 i:P iskey:0 type:B checksum:CF15D48E plane_checksum:[CB69A1EF 637DBF49 5FAF7347][Parsed_showinfo_0 0xf675c0] n:2 pts:2400 pts_time:0.08 pos:373819 fmt:yuv420p sar:1/1 s:1280x720 i:P iskey:0 type:B checksum:5974D3B6 plane_checksum:[53AAA123 0C00BF3F 976C7345][Parsed_showinfo_0 0xf675c0] n:3 pts:3600 pts_time:0.12 pos:345089 fmt:yuv420p sar:1/1 s:1280x720 i:P iskey:0 type:P checksum:8D43B49A plane_checksum:[FBCBC61A AE12A284 E4DA4BED][Parsed_showinfo_0 0xf675c0] n:4 pts:4800 pts_time:0.16 pos:414675 fmt:yuv420p sar:1/1 s:1280x720 i:P iskey:0 type:B checksum:6C5487AC plane_checksum:[22107838 FE5FB347 755C5C1E][Parsed_showinfo_0 0xf675c0] n:5 pts:6000 pts_time:0.2 pos:430027 fmt:yuv420p sar:1/1 s:1280x720 i:P iskey:0 type:B checksum:AF33CE8C plane_checksum:[3C499702 6B0DC18A B51375F1][Parsed_showinfo_0 0xf675c0] n:6 pts:7200 pts_time:0.24 pos:377169 fmt:yuv420p sar:1/1 s:1280x720 i:P iskey:0 type:P checksum:4606BBA6 plane_checksum:[BF20865F 7FECA5AB 614E8F8D]这个滤镜会将视频每一帧的详细信息都输出在做视频详细分析的时候很好用这里用到的是i参数信息具体的参数信息可以参考FFmpeg官方文档关于i的说明是这样的 ‘i’interlaced mode (P for progressive, T for top field first, B for bottom field first)隔行扫描模式(P代表逐行“T”代表上场优先“B”代表下场优先)通过提取这个参数的信息即可区分出来视频是隔行还是逐行的。