ffmpeg mkv到mp4,包括字幕

时间:2017-02-01 12:56:02

标签: video ffmpeg mp4 mkv

想要将mkv文件转换为mp4(h264,mp3和subtitles)。我用ffprobe检查了视频文件。对于输出

  

Stream#0:2(ger):字幕:dvb_subtitle(默认)

使用以下ffmpeg命令将转换后的视频中包含字幕。

ffmpeg -i movie.mkv -c:v libx264 -c:a libmp3lame  -b:a 320k -c:s dvd_subtitle  converted.mp4

但是对于输出:

  

Stream#0:3(ger):Subtitle:subrip(默认)

该命令无效。没有错误消息,生成的视频包含字幕流,但没有显示字幕。我也尝试使用字幕编码mov_text和copy,但没有运气。跟随控制台的输出:

    ffmpeg version 3.2.2-1 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 6.2.1 (Debian 6.2.1-5) 20161124
  configuration: --prefix=/usr --extra-version=1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-libopencv --enable-frei0r --enable-libx264 --enable-chromaprint --enable-shared
  WARNING: library configuration mismatch
  avcodec     configuration: --prefix=/usr --extra-version=1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-libopencv --enable-frei0r --enable-libx264 --enable-chromaprint --enable-shared --enable-version3 --disable-doc --disable-programs --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libtesseract --enable-libvo_amrwbenc --enable-netcdf
  libavutil      55. 34.100 / 55. 34.100
  libavcodec     57. 64.101 / 57. 64.101
  libavformat    57. 56.100 / 57. 56.100
  libavdevice    57.  1.100 / 57.  1.100
  libavfilter     6. 65.100 /  6. 65.100
  libavresample   3.  1.  0 /  3.  1.  0
  libswscale      4.  2.100 /  4.  2.100
  libswresample   2.  3.100 /  2.  3.100
  libpostproc    54.  1.100 / 54.  1.100
[mpeg2video @ 0x56335b2e1180] warning: first frame is no keyframe
Input #0, matroska,webm, from 'movie.mkv':
  Metadata:
    title           : The Movie name
    encoder         : Tvheadend Matroska muxer
    DATE_BROADCASTED: 2014-08-17 20:14:20
    ORIGINAL_MEDIA_TYPE: TV
    TVCHANNEL       : a channel
    SUMMARY         : summary
    SUMMARY-ger     : summary
    DESCRIPTION     : blablabla
  Duration: 02:22:35.55, start: 0.000000, bitrate: 3689 kb/s
    Chapter #0:0: start 354.274000, end 1854.154000
    Chapter #0:1: start 1854.154000, end 2333.434000
    Chapter #0:2: start 2333.434000, end 3541.234000
    Chapter #0:3: start 3541.234000, end 4016.554000
    Chapter #0:4: start 4016.554000, end 5369.434000
    Chapter #0:5: start 5369.434000, end 5838.874000
    Chapter #0:6: start 5838.874000, end 6885.754000
    Chapter #0:7: start 6885.754000, end 7337.314000
    Chapter #0:8: start 7337.314000, end 8313.514000
    Chapter #0:9: start 8313.514000, end 8358.514000
    Chapter #0:10: start 8358.514000, end 8555.554000
    Stream #0:0(eng): Video: mpeg2video (Main), yuv420p(tv, top first), 720x576 [SAR 64:45 DAR 16:9], 25 fps, 25 tbr, 1k tbn, 50 tbc (default)
    Stream #0:1(ger): Audio: mp2, 48000 Hz, stereo, s16p, 192 kb/s (default)
    Stream #0:2(ger): Audio: ac3, 48000 Hz, stereo, fltp, 384 kb/s (default)
    Stream #0:3(ger): Subtitle: subrip (default)
[libx264 @ 0x56335b31c8a0] using SAR=64/45
[libx264 @ 0x56335b31c8a0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x56335b31c8a0] profile High, level 3.0
[libx264 @ 0x56335b31c8a0] 264 - core 148 r2708 86b7198 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'The-Movie_name.mkv.mp4':
  Metadata:
    title           : The Movie name
    DESCRIPTION-ger : BlaBlaBla
    encoder         : Lavf57.56.100
    Chapter #0:0: start 354.274000, end 1854.154000
    Chapter #0:1: start 1854.154000, end 2333.434000
    Chapter #0:2: start 2333.434000, end 3541.234000
    Chapter #0:3: start 3541.234000, end 4016.554000
    Chapter #0:4: start 4016.554000, end 5369.434000
    Chapter #0:5: start 5369.434000, end 5838.874000
    Chapter #0:6: start 5838.874000, end 6885.754000
    Chapter #0:7: start 6885.754000, end 7337.314000
    Chapter #0:8: start 7337.314000, end 8313.514000
    Chapter #0:9: start 8313.514000, end 8358.514000
    Chapter #0:10: start 8358.514000, end 8555.554000
    Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 720x576 [SAR 64:45 DAR 16:9], q=-1--1, 25 fps, 12800 tbn, 25 tbc (default)
    Metadata:
      encoder         : Lavc57.64.101 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1(ger): Audio: mp3 (libmp3lame) (i[0][0][0] / 0x0069), 48000 Hz, stereo, s16p, 320 kb/s (default)
    Metadata:
      encoder         : Lavc57.64.101 libmp3lame
    Stream #0:2(ger): Subtitle: dvd_subtitle (dvdsub) ([224][0][0][0] / 0x00E0) (default)
    Metadata:
      encoder         : Lavc57.64.101 dvdsub
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg2video (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (mp2 (native) -> mp3 (libmp3lame))
  Stream #0:3 -> #0:2 (subrip (srt) -> dvd_subtitle (dvdsub))
Press [q] to stop, [?] for help
[mpeg2video @ 0x56335b31bb20] warning: first frame is no keyframe
[dvdsub @ 0x56335b2f8600] Bitmap subtitle required:00:31.41 bitrate= 685.0kbits/s dup=15 drop=2 speed=3.65x    
Subtitle encoding failed
[libx264 @ 0x56335b31c8a0] frame I:4     Avg QP:13.61  size: 32211
[libx264 @ 0x56335b31c8a0] frame P:202   Avg QP:21.61  size:  8129
[libx264 @ 0x56335b31c8a0] frame B:551   Avg QP:28.86  size:  1021
[libx264 @ 0x56335b31c8a0] consecutive B-frames:  0.8%  4.2%  5.9% 89.1%
[libx264 @ 0x56335b31c8a0] mb I  I16..4: 36.4% 49.0% 14.7%
[libx264 @ 0x56335b31c8a0] mb P  I16..4:  1.6%  3.2%  0.7%  P16..4: 20.8%  9.1%  6.0%  0.0%  0.0%    skip:58.7%
[libx264 @ 0x56335b31c8a0] mb B  I16..4:  0.1%  0.1%  0.0%  B16..8: 17.9%  1.6%  0.4%  direct: 0.7%  skip:79.3%  L0:40.6% L1:48.8% BI:10.5%
[libx264 @ 0x56335b31c8a0] 8x8 transform intra:55.5% inter:69.0%
[libx264 @ 0x56335b31c8a0] coded y,uvDC,uvAC intra: 46.1% 45.6% 23.5% inter: 5.3% 5.4% 2.1%
[libx264 @ 0x56335b31c8a0] i16 v,h,dc,p: 40% 44%  6% 10%
[libx264 @ 0x56335b31c8a0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 33% 33%  2%  2%  3%  2%  3%  3%
[libx264 @ 0x56335b31c8a0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 37% 29% 14%  3%  3%  4%  3%  4%  3%
[libx264 @ 0x56335b31c8a0] i8c dc,h,v,p: 47% 29% 21%  3%
[libx264 @ 0x56335b31c8a0] Weighted P-Frames: Y:1.0% UV:0.0%
[libx264 @ 0x56335b31c8a0] ref P L0: 62.3% 12.0% 18.2%  7.5%  0.0%
[libx264 @ 0x56335b31c8a0] ref B L0: 84.6% 11.5%  3.8%
[libx264 @ 0x56335b31c8a0] ref B L1: 94.9%  5.1%
[libx264 @ 0x56335b31c8a0] kb/s:616.48
[libmp3lame @ 0x56335b2f7880] 3 frames left in the queue on closing
Conversion failed!

有什么想法吗?

0 个答案:

没有答案