ITPub博客

首页 > 自动化运维 > 大规模网络运维 > [20211019]ffmpeg为视频添加字幕.txt

[20211019]ffmpeg为视频添加字幕.txt

原创 大规模网络运维 作者:lfree 时间:2021-10-21 09:16:24 0 删除 编辑

[20211019]ffmpeg为视频添加字幕.txt

--//前几天将mkv转成mp4,我在电脑播放带字幕没有问题,但是在tv上无法看到字幕。上网在找了一些链接,发现:


--//修改执行如下:
ffmpeg -i a.mp4 -i a.idx -i a.sub -map 0:v -map 0:a -c copy -map 1 -c:s:1 dvd_subtitle -metadata:s:s:1 language=ch b.mp4

>ffmpeg -i a.mp4 -i a.idx -i a.sub -map 0:v -map 0:a -c copy -map 1 -c:s:1 dvd_subtitle -metadata:s:s:1 language=ch b.mp4
ffmpeg version N-69060-gcd960c8 Copyright (c) 2000-2015 the FFmpeg developers
  built on Jan 14 2015 22:13:45 with gcc 4.9.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinge
r --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-
libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-zlib
  libavutil      54. 16.100 / 54. 16.100
  libavcodec     56. 20.100 / 56. 20.100
  libavformat    56. 18.101 / 56. 18.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5.  7.101 /  5.  7.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'a.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.18.101
  Duration: 01:25:19.64, start: 0.000000, bitrate: 1150 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 720x464 [SAR 1:1 DAR 45:29], 953 kb/s, 25 fps, 25 tbr, 16k tbn, 50 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, stereo, fltp, 192 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Input #1, vobsub, from 'a.idx':
  Duration: N/A, bitrate: N/A
    Stream #1:0[0x0](zh): Subtitle: dvd_subtitle, 720x576 (default)
    Stream #1:1[0x1](zh): Subtitle: dvd_subtitle, 720x576
Input #2, mpeg, from 'a.sub':
  Duration: 01:22:39.16, start: 15.469811, bitrate: 14 kb/s
    Stream #2:0[0x20]: Subtitle: dvd_subtitle
    Stream #2:1[0x21]: Subtitle: dvd_subtitle
[mp4 @ 0000000002e32dc0] track 1: codec frame size is not set
Output #0, mp4, to 'b.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.18.101
    Stream #0:0(eng): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 720x464 [SAR 1:1 DAR 45:29], q=2-31, 953 kb/s, 25 fps, 25 tbr, 16k tbn, 16k tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: ac3 ([165][0][0][0] / 0x00A5), 48000 Hz, stereo, 192 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
    Stream #0:2(zh): Subtitle: dvd_subtitle ([224][0][0][0] / 0x00E0), 720x576 (default)
    Stream #0:3(ch): Subtitle: dvd_subtitle (dvdsub) ([224][0][0][0] / 0x00E0), 720x576
    Metadata:
      encoder         : Lavc56.20.100 dvdsub
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
  Stream #1:0 -> #0:2 (copy)
  Stream #1:1 -> #0:3 (dvd_subtitle (dvdsub) -> dvd_subtitle (dvdsub))
Press [q] to stop, [?] for help
frame=127991 fps=11016 q=-1.0 Lsize=  722893kB time=01:25:19.61 bitrate=1156.7kbits/s
video:595630kB audio:119991kB subtitle:4035kB other streams:0kB global headers:1kB muxing overhead: 0.449957%

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/267265/viewspace-2838451/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
熟悉oracle相关技术,擅长sql优化,rman备份与恢复,熟悉linux shell编程。

注册时间:2008-01-03

  • 博文量
    3085
  • 访问量
    6808076