无法使用 ffmpeg 更改视频字幕编解码器 [英] Can't change video subtitles codec using ffmpeg

查看:42
本文介绍了无法使用 ffmpeg 更改视频字幕编解码器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个嵌入了一些流的 mkv 文件:

I've got a mkv file with somes streams embedded:

Stream #0:0: Video: h264 (High), yuv420p(tv, smpte170m/smpte170m/bt709), 720x300, SAR 1:1 DAR 12:5, 25 fps, 25 tbr, 48003.07 tbn, 50 tbc (default)
Stream #0:1(tr): Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s (default)
Stream #0:2(fr): Subtitle: dvd_subtitle, 720x300

在我的电脑上播放时,我可以看到字幕.从我的旧 DVD/DIVX 播放器播放时,我看不到字幕(其他 mkv/avi 工作正常).

When playing on my PC, I can see subtitles. When playing it from my old DVD/DIVX player, I cannot see the subtitles (other mkv/avi work fine).

所以我想改变字幕编码,看看另一个是否可以与我的 DVD 播放器一起使用.

So I wanted to change the subtitle encoding, to see if another one could work with my DVD player.

ffmpeg -encoders 报告:

ffmpeg -encoders reports:

 S..... ssa                  ASS (Advanced SubStation Alpha) subtitle (codec ass)
 S..... ass                  ASS (Advanced SubStation Alpha) subtitle
 S..... dvbsub               DVB subtitles (codec dvb_subtitle)
 S..... dvdsub               DVD subtitles (codec dvd_subtitle)
 S..... mov_text             3GPP Timed Text subtitle
 S..... srt                  SubRip subtitle (codec subrip)
 S..... subrip               SubRip subtitle
 S..... text                 Raw text subtitle
 S..... webvtt               WebVTT subtitle
 S..... xsub                 DivX subtitles (XSUB)

所以我尝试了:

ffmpeg -i input.mkv -acodec copy -vcodec copy -scodec "codec" converted.mkv

具有各种版本的编解码器".它们都不起作用(除了原始的 dvdsub...):

with various versions of "codec". None of them will work (except the original dvdsub...):

xsub 报告:

[matroska @ 0x24558c0] Subtitle codec 94211 is not supported.
av_interleaved_write_frame(): Function not implemented
[matroska @ 0x24558c0] Subtitle codec 94211 is not supported.
Error writing trailer of mustang_converted.mkv: Function not implementedframe=  244 fps=0.0 q=-1.0 Lsize=       1kB time=00:00:10.01 bitrate=   1.0kbits/s speed=1.23e+03x    
video:321kB audio:235kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Conversion failed!

ssa 或 ass 报告:

ssa or ass reports:

[ssa @ 0x262e000] Only SUBTITLE_ASS type supported.
Subtitle encoding failed

其他人报告:

Error while opening encoder for output stream #0:2 - maybe incorrect parameters such as bit_rate, rate, width or height

我做错了什么?某些字幕编解码器是否与当前的视频或音频编解码器不兼容?我应该改变那些而不是复制吗?

What am I doing wrong? Are some subtitles codec incompatible with the current video or audio codec? Should I change those instead of copying?

或者,是否可以选择在视频图像流中永久合并字幕(然后只有两个输出流:音频和视频但保留字幕显示)?

Alternatively, is there an option to merge subtitle within the video images stream for good (and then have only two output streams: audio and video but preserve subtitles display)?

注意:如果在 Linux (mint) 下工作,使用 ffmpeg 以外的其他工具回答是可以接受的.

Note: Answer using another tool than ffmpeg are acceptable, if working under Linux (mint).

推荐答案

您的字幕是基于图像的,需要转换为基于文本的格式,如 SRT.使用 字幕编辑 或类似工具从 MKV 导入字幕.这将对 subs 进行 OCR 处理.完成后,另存为 SRT 或任何常见的基于文本的字幕格式.

Your subtitles are image-based and need to be converted to a text-based format like SRT. Use Subtitle Edit or similar tool to import the subs from MKV. This will do OCR processing of the subs. Once done, save as SRT or any common text-based subtitle format.

然后使用您选择的编解码器运行您的 ffmpeg 命令.

Then run your ffmpeg command with scodec of your choice.

或者,如果您想刻录字幕,可以尝试其中一种方法

Alternatively, if you want to burn in the subtitles, you can try one of these methods

ffmpeg -i input.mkv -vf subtitles=input.mkv -acodec copy -sn converted.mkv

ffmpeg -i input.mkv -filter_complex "[0:v:0][0:2]overlay" -acodec copy -sn converted.mkv

这篇关于无法使用 ffmpeg 更改视频字幕编解码器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆