使用ffmpeg更改帧速率时如何获取丢弃的帧数
How to get the frame numbers that are dropped when changing the frame rate using ffmpeg
我有一个以 30fps 播放的视频。我使用命令将帧速率更改为 20fps
ffmpeg -i lamp02_20210212_060804-compressed.mp4 -filter:v fps=20 xx.mp4
。但我想获得丢帧的帧数。我在这里 Which frame does ffmpeg get when reducing the frame rate 看到您可以获得框架,但我只需要框架编号。是否可以这样做,如果可以,怎么做?任何正确方向的指示都会有所帮助!
您可以转储调试日志并检查它们。
ffmpeg -i input -vf fps=20 -an -f null - -v debug 2>&1 | grep Parsed_fps
输出将包含以下形式的行,
[Parsed_fps_0 @ 000002619a56bd40] Read frame with in pts 11264, out pts 15
[Parsed_fps_0 @ 000002619a56bd40] Writing frame with pts 14 to pts 14
[Parsed_fps_0 @ 000002619a56bd40] Read frame with in pts 11776, out pts 15
[Parsed_fps_0 @ 000002619a56bd40] Dropping frame with pts 15
[Parsed_fps_0 @ 000002619a56bd40] Read frame with in pts 12288, out pts 16
[Parsed_fps_0 @ 000002619a56bd40] Writing frame with pts 15 to pts 15
所有积分均以计价。 in pts
的时基是输入流的 tbn 值的倒数。 out pts
的时基是过滤器输出 fps 的倒数。
跟踪显示 Dropping frame with pts ..
的帧的 in pts
并获取它们的时间戳值。
我有一个以 30fps 播放的视频。我使用命令将帧速率更改为 20fps
ffmpeg -i lamp02_20210212_060804-compressed.mp4 -filter:v fps=20 xx.mp4
。但我想获得丢帧的帧数。我在这里 Which frame does ffmpeg get when reducing the frame rate 看到您可以获得框架,但我只需要框架编号。是否可以这样做,如果可以,怎么做?任何正确方向的指示都会有所帮助!
您可以转储调试日志并检查它们。
ffmpeg -i input -vf fps=20 -an -f null - -v debug 2>&1 | grep Parsed_fps
输出将包含以下形式的行,
[Parsed_fps_0 @ 000002619a56bd40] Read frame with in pts 11264, out pts 15
[Parsed_fps_0 @ 000002619a56bd40] Writing frame with pts 14 to pts 14
[Parsed_fps_0 @ 000002619a56bd40] Read frame with in pts 11776, out pts 15
[Parsed_fps_0 @ 000002619a56bd40] Dropping frame with pts 15
[Parsed_fps_0 @ 000002619a56bd40] Read frame with in pts 12288, out pts 16
[Parsed_fps_0 @ 000002619a56bd40] Writing frame with pts 15 to pts 15
所有积分均以in pts
的时基是输入流的 tbn 值的倒数。 out pts
的时基是过滤器输出 fps 的倒数。
跟踪显示 Dropping frame with pts ..
的帧的 in pts
并获取它们的时间戳值。