Я пытаюсь преобразовать видео MKV в MP4, но он не работает с кодами, которые я использую.

Я обычно использую один из этих 2 кодов:

ffmpeg -i input.mkv -c:v copy -c:a copy output.mp4 ffmpeg -i input.mkv -acodec aac -strict -2 -ab 320k -c:v copy output.mp4

Для видео я пытаюсь конвертировать оба не работают вообще. Я все еще новичок в этом, и я не понимаю, почему я получаю эти результаты.

В результате получается mp4, который представляет собой только черный экран, который не воспроизводит видео или звук.

Код 1:

ffmpeg -i input.mkv -c:v copy -c:a copy output.mp4

Результаты:

ffmpeg version N-73633-gdfc5858 Copyright (c) 2000-2015 the FFmpeg developers
  built 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-libdcadec --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-libschroedinger --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. 28.100 / 54. 28.100
  libavcodec     56. 47.100 / 56. 47.100
  libavformat    56. 40.100 / 56. 40.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 21.100 /  5. 21.100
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.100 /  1.  2.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, matroska,webm, from 'tb1.mkv':
  Metadata:
    title           : #01 All's well that ends well.
    encoder         : libebml v1.3.0 + libmatroska v1.4.0
    creation_time   : 2013-05-22 02:07:43
  Duration: 00:24:16.33, start: 0.000000, bitrate: 4643 kb/s
    Chapter #0:0: start 0.000000, end 51.051000
    Metadata:
      title           : Introduction
    Chapter #0:1: start 51.051000, end 142.142000
    Metadata:
      title           : OP - "Orion wo Nazoru"
    Chapter #0:2: start 142.142000, end 627.293333
    Metadata:
      title           : Part A
    Chapter #0:3: start 627.293333, end 1326.033042
    Metadata:
      title           : Part B
    Chapter #0:4: start 1326.033042, end 1416.331583
    Metadata:
      title           : ED - "Hoshi no Sumika"
    Chapter #0:5: start 1416.331583, end 1440.439000
    Metadata:
      title           : Conclusion
    Chapter #0:6: start 1440.439000, end 1456.330000
    Metadata:
      title           : Next Time
    Stream #0:0: Video: h264 (High 10), yuv420p10le, 1280x720 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Metadata:
      title           : 720p 10-bit h.264
    Stream #0:1(jpn): Audio: aac (LC), 48000 Hz, stereo, fltp (default)
    Metadata:
      title           : Japanese Dialogue (2.0 AAC)
    Stream #0:2(eng): Audio: aac (LC), 48000 Hz, stereo, fltp
    Metadata:
      title           : English Dialogue (2.0 AAC)
    Stream #0:3(jpn): Subtitle: ass (default)
    Metadata:
      title           : Full Subtitles - Karaoke & Hero Colors (ASS)
    Stream #0:4(jpn): Subtitle: ass
    Metadata:
      title           : Full Subtitles - Plain (ASS)
    Stream #0:5(eng): Subtitle: ass
    Metadata:
      title           : Theme Song Only Subtitles - Karaoke (ASS)
    Stream #0:6(eng): Subtitle: ass
    Metadata:
      title           : Theme Song Only Subtitles - Plain (ASS)
    Stream #0:7: Attachment: ttf
    Metadata:
      filename        : BELL.TTF
      mimetype        : application/x-truetype-font
    Stream #0:8: Attachment: ttf
    Metadata:
      filename        : BELLI.TTF
      mimetype        : application/x-truetype-font
    Stream #0:9: Attachment: ttf
    Metadata:
      filename        : KOMTXT__.ttf
      mimetype        : application/x-truetype-font
    Stream #0:10: Attachment: ttf
    Metadata:
      filename        : KOMTXTI_.ttf
      mimetype        : application/x-truetype-font
    Stream #0:11: Attachment: ttf
    Metadata:
      filename        : TEMPSITC.TTF
      mimetype        : application/x-truetype-font
[mp4 @ 00000000053fd800] Codec for stream 0 does not use global headers but container format requires global headers
[mp4 @ 00000000053fd800] Codec for stream 1 does not use global headers but container format requires global headers
Output #0, mp4, to 'tb1.mp4':
  Metadata:
    title           : #01 All's well that ends well.
    encoder         : Lavf56.40.100
    Chapter #0:0: start 0.000000, end 51.051000
    Metadata:
      title           : Introduction
    Chapter #0:1: start 51.051000, end 142.142000
    Metadata:
      title           : OP - "Orion wo Nazoru"
    Chapter #0:2: start 142.142000, end 627.293333
    Metadata:
      title           : Part A
    Chapter #0:3: start 627.293333, end 1326.033042
    Metadata:
      title           : Part B
    Chapter #0:4: start 1326.033042, end 1416.331583
    Metadata:
      title           : ED - "Hoshi no Sumika"
    Chapter #0:5: start 1416.331583, end 1440.439000
    Metadata:
      title           : Conclusion
    Chapter #0:6: start 1440.439000, end 1456.330000
    Metadata:
      title           : Next Time
    Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p10le, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 23.98 fps, 23.98 tbr, 16k tbn, 1k tbc (default)
    Metadata:
      title           : 720p 10-bit h.264
    Stream #0:1(jpn): Audio: aac ([64][0][0][0] / 0x0040), 48000 Hz, stereo (default)
    Metadata:
      title           : Japanese Dialogue (2.0 AAC)
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=34917 fps=1057 q=-1.0 Lsize=  795559kB time=00:24:16.30 bitrate=4475.2kbits/s
video:763789kB audio:30446kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.166663%

Код 2:

ffmpeg -i input.mkv -acodec aac -strict -2 -ab 320k -c:v copy output.mp4

Результаты:

Input #0, matroska,webm, from 'tb1.mkv':
  Metadata:
    title           : #01 All's well that ends well.
    encoder         : libebml v1.3.0 + libmatroska v1.4.0
    creation_time   : 2013-05-22 02:07:43
  Duration: 00:24:16.33, start: 0.000000, bitrate: 4643 kb/s
    Chapter #0:0: start 0.000000, end 51.051000
    Metadata:
      title           : Introduction
    Chapter #0:1: start 51.051000, end 142.142000
    Metadata:
      title           : OP - "Orion wo Nazoru"
    Chapter #0:2: start 142.142000, end 627.293333
    Metadata:
      title           : Part A
    Chapter #0:3: start 627.293333, end 1326.033042
    Metadata:
      title           : Part B
    Chapter #0:4: start 1326.033042, end 1416.331583
    Metadata:
      title           : ED - "Hoshi no Sumika"
    Chapter #0:5: start 1416.331583, end 1440.439000
    Metadata:
      title           : Conclusion
    Chapter #0:6: start 1440.439000, end 1456.330000
    Metadata:
      title           : Next Time
    Stream #0:0: Video: h264 (High 10), yuv420p10le, 1280x720 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Metadata:
      title           : 720p 10-bit h.264
    Stream #0:1(jpn): Audio: aac (LC), 48000 Hz, stereo, fltp (default)
    Metadata:
      title           : Japanese Dialogue (2.0 AAC)
    Stream #0:2(eng): Audio: aac (LC), 48000 Hz, stereo, fltp
    Metadata:
      title           : English Dialogue (2.0 AAC)
    Stream #0:3(jpn): Subtitle: ass (default)
    Metadata:
      title           : Full Subtitles - Karaoke & Hero Colors (ASS)
    Stream #0:4(jpn): Subtitle: ass
    Metadata:
      title           : Full Subtitles - Plain (ASS)
    Stream #0:5(eng): Subtitle: ass
    Metadata:
      title           : Theme Song Only Subtitles - Karaoke (ASS)
    Stream #0:6(eng): Subtitle: ass
    Metadata:
      title           : Theme Song Only Subtitles - Plain (ASS)
    Stream #0:7: Attachment: ttf
    Metadata:
      filename        : BELL.TTF
      mimetype        : application/x-truetype-font
    Stream #0:8: Attachment: ttf
    Metadata:
      filename        : BELLI.TTF
      mimetype        : application/x-truetype-font
    Stream #0:9: Attachment: ttf
    Metadata:
      filename        : KOMTXT__.ttf
      mimetype        : application/x-truetype-font
    Stream #0:10: Attachment: ttf
    Metadata:
      filename        : KOMTXTI_.ttf
      mimetype        : application/x-truetype-font
    Stream #0:11: Attachment: ttf
    Metadata:
      filename        : TEMPSITC.TTF
      mimetype        : application/x-truetype-font
[mp4 @ 00000000031b8e00] Codec for stream 0 does not use global headers but container format requires global headers
Output #0, mp4, to 'tb1.mp4':
  Metadata:
    title           : #01 All's well that ends well.
    encoder         : Lavf56.40.100
    Chapter #0:0: start 0.000000, end 51.051000
    Metadata:
      title           : Introduction
    Chapter #0:1: start 51.051000, end 142.142000
    Metadata:
      title           : OP - "Orion wo Nazoru"
    Chapter #0:2: start 142.142000, end 627.293333
    Metadata:
      title           : Part A
    Chapter #0:3: start 627.293333, end 1326.033042
    Metadata:
      title           : Part B
    Chapter #0:4: start 1326.033042, end 1416.331583
    Metadata:
      title           : ED - "Hoshi no Sumika"
    Chapter #0:5: start 1416.331583, end 1440.439000
    Metadata:
      title           : Conclusion
    Chapter #0:6: start 1440.439000, end 1456.330000
    Metadata:
      title           : Next Time
    Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p10le, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 23.98 fps, 23.98 tbr, 16k tbn, 1k tbc (default)
    Metadata:
      title           : 720p 10-bit h.264
    Stream #0:1(jpn): Audio: aac ([64][0][0][0] / 0x0040), 48000 Hz, stereo, fltp, 320 kb/s (default)
    Metadata:
      title           : Japanese Dialogue (2.0 AAC)
      encoder         : Lavc56.47.100 aac
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
frame=34917 fps=142 q=-1.0 Lsize=  821767kB time=00:24:16.30 bitrate=4622.6kbits/s
video:763789kB audio:56654kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.161340%

Если кто-нибудь может помочь мне выяснить, что происходит, это будет высоко ценится.

1 ответ1

2

Ваш вывод - 10- битное видео (yuv420p10le) - я думаю, WMP и несколько других игроков не справятся с этим.

Для совместимости вы должны конвертировать (перекодировать) видео, используя -pix_fmt yuv420p чтобы вернуться к 8- битному кодированию, которое является значением по умолчанию для большинства видеоприложений сегодня, если вы не хотите использовать HDR или увеличить цветовую гамму.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками .