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

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

问题描述

 流#0:0:视频:h264(高),yuv420p(tv,smpte170m / smpte170m / bt709),720x300,SAR 1:1 DAR 12:5,25 fps,25 tbr,48003.07 tbn,50 tbc(默认)
流#0:1(tr) :音频:ac3,48000 Hz,立体声,fltp,192 kb / s(默认)
流#0:2(fr):副标题:dvd_subtitle,720x300
pre>

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



所以我想改变字幕编码,看看是否有人可以使用我的DVD播放器。



ffmpeg -encoders报告:

  S ..... ssa ASS(高级子站Alpha)字幕(编解码器屁股)
S ..... ass ASS(高级子站Alpha)字幕
S ..... dvbsub DVB字幕(codec dvb_subtitle)
S ..... dvdsub DVD字幕(codec dvd_subtitle)
S ..... mov_text 3GPP定时文本字幕
S ..... srt SubRip subtitle(codec subrip)
S ..... subrip SubRip subtitle
S .....文本原文字幕
S ..... webvtt WebVTT字幕
S ..... xsub DivX字幕(XSUB)

所以我试过:

  ffmpeg -i输入。 mkv -acodec copy -vcodec copy -scodeccodecconverted.mkv 

wi各种版本的编解码器。他们都不会工作(除了原来的 dvdsub ...):



xsub报告:

  [matroska @ 0x24558c0]不支持字幕编解码器94211。 
av_interleaved_write_frame():功能未实现
[matroska @ 0x24558c0]不支持字幕编解码器94211。
错误编写mustang_converted.mkv的预告片:功能未实现帧= 244 fps = 0.0 q = -1.0 Lsize = 1kB时间= 00:00:10.01比特率= 1.0kbits / s速度= 1.23e + 03x
视频:321kB音频:235kB字幕:0kB其他流:0kB全局头文件:0kB多路复用开销:未知
转换失败!

ssa或屁股报告:

  [ssa @ 0x262e000]仅支持SUBTITLE_ASS类型。 
字幕编码失败

其他报告:

 打开编码器输出流#0时出错:2  - 可能是不正确的参数,如bit_rate,rate,width或height 
pre>

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



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



注意:如果在Linux(mint)下工作,则使用另一个工具,而不是ffmpeg的答案是可以接受的。

解决方案

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



然后使用您选择的scodec运行您的ffmpeg命令。






或者,如果要在字幕中刻录,可以尝试以下方法之一:

  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 


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

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).

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

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)

So I tried:

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

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

xsub reports:

[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 or ass reports:

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

others reports:

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)?

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

解决方案

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.

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

or

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

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

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