温馨提示:本文翻译自stackoverflow.com,查看原文请点击:其他 - FFMPEG: Encoding WEBM with fast-seek and copyts leads to wrong video length
ffmpeg

其他 - FFMPEG:使用快速搜索和复制编码WEBM会导致错误的视频长度

发布于 2020-04-08 12:21:18

我正在尝试通过两次通过将场景从软字幕MKV文件转换为硬字幕WEBM文件。视频编码正常,但是在媒体播放器上打开时文件显示的长度错误(这似乎是我从起点一直到末尾对原始文件进行了编码)。

这是我正在使用的命令:

set timestamp=-ss 12:59.069 -to 16:14.277

ffmpeg -y %timestamp% -copyts -i source.mkv -shortest -c:v libvpx-vp9 -pass 1 -b:v 0 -crf 33 -threads 8 -speed 4 -tile-columns 6 -frame-parallel 1 -an -sn -vf scale=-1:720,subtitles=source.mkv -f webm NUL
ffmpeg -y %timestamp% -copyts -i source.mkv -shortest -c:v libvpx-vp9 -pass 2 -b:v 0 -crf 33 -threads 8 -speed 2 -tile-columns 6 -frame-parallel 1 -auto-alt-ref 1 -lag-in-frames 25 -c:a libopus -b:a 64k -sn -vf scale=-1:720,subtitles=source.mkv -f webm out.webm

在MPC-BE中打开视频时,该视频会定期播放,直到https://i.stack.imgur.com/6bRwc.png(我要剪切的场景在此结束)上显示的点为止跳到文件末尾,当我尝试使用编码视频时,这种错误的长度给我带来了各种各样的问题。

查看更多

提问者
TheOverlord2D
被浏览
54
Gyan 2020-02-01 14:19

显然,您的播放器不喜欢非零的开始时间戳(至少在WebM中如此)。

因此,请在写入之前重置时间戳(我假设您使用的是字幕过滤器对齐方式的副本)。

在通行证2中

ffmpeg -y %timestamp% -copyts -i source.mkv -shortest -c:v libvpx-vp9 -pass 2 -b:v 0 -crf 33 -threads 8 -speed 2 -tile-columns 6 -frame-parallel 1 -auto-alt-ref 1 -lag-in-frames 25 -c:a libopus -b:a 64k -sn -vf scale=-1:720,subtitles=source.mkv -output_ts_offset -12:59.069 -f webm out.web

ts offset的值是ss值的负数。