我需要从不同的视频文件中提取字幕以.srt
格式化(在 html5 视频中使用)。我尝试了很多我在谷歌上找到的变体。但每次我得到这个错误:
为输出流 #0:0 打开编码器时出错 - 可能是不正确的参数,例如 bit_rate、rate、width 或 height
我认为,这个错误意味着 ffmpeg 可以解码源字幕但不能将其编码为.srt
格式。所有编解码器都启用(我用不同的配置从 git 编译了后来的 ffmpeg 版本几次)。
这是输出:
# /usr/local/bin/ffmpeg -i /var/video/sources/Balbesy1.m2ts -an -vn -copyinkf -scodec srt -f srt -y sub.srt
ffmpeg version N-49947-g9f16cb9 Copyright (c) 2000-2013 the FFmpeg developers
built on Feb 14 2013 14:26:10 with gcc 4.4.5 (Debian 4.4.5-8)
configuration: --enable-encoder=dvdsub --enable-decoder=dvdsub --enable-decoder=pgssub --enable-encoder=srt --enable-decoder=srt --enable-encoder=srt --enable-decoder=srt
libavutil 52. 17.101 / 52. 17.101
libavcodec 54. 91.103 / 54. 91.103
libavformat 54. 63.100 / 54. 63.100
libavdevice 54. 3.103 / 54. 3.103
libavfilter 3. 37.101 / 3. 37.101
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
[mpegts @ 0x2719040] Stream #5: not enough frames to estimate rate; consider increasing probesize
[mpegts @ 0x2719040] Could not find codec parameters for stream 5 (Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[NULL @ 0x271fec0] start time is not set in estimate_timings_from_pts
Input #0, mpegts, from '/var/video/sources/Balbesy1.m2ts':
Duration: 01:18:11.89, start: 599.958300, bitrate: 37378 kb/s
Program 1
Stream #0:0[0x1011]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 90k tbn, 47.95 tbc
Stream #0:1[0x1100]: Audio: dts (DTS-HD MA) ([134][0][0][0] / 0x0086), 48000 Hz, 5.1(side), fltp, 768 kb/s
Stream #0:2[0x1101]: Audio: dts (DTS-HD MA) ([134][0][0][0] / 0x0086), 48000 Hz, 5.1(side), fltp, 768 kb/s
Stream #0:3[0x1102]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 448 kb/s
Stream #0:4[0x1103]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 448 kb/s
Stream #0:5[0x1200]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
Output #0, srt, to 'sub.srt':
Stream #0:0: Subtitle: srt
Stream mapping:
Stream #0:5 -> #0:0 (pgssub -> srt)
Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
对不起我的英语不好