我正在尝试将 h265 MKV 重新转换为 MP4,而无需转码。我的演示视频是钢铁之泪。
我正在使用以下命令,但无法播放生成的文件
ffmpeg -i tos-1720x720-cfg01.mkv -tag:v hvc1 -codec copy tos-1720x720-cfg01.mp4
命令输出:
ffmpeg -i tos-1720x720-cfg01.mkv -tag:v hvc1 -codec copy tos-1720x720-cfg01.mp4
ffmpeg version 4.4 Copyright (c) 2000-2021 the FFmpeg developers
built with Apple clang version 12.0.0 (clang-1200.0.32.29)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.4_1 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
Input #0, matroska,webm, from 'tos-1720x720-cfg01.mkv':
Metadata:
encoder : libebml v1.3.0 + libmatroska v1.4.1
creation_time : 2014-03-18T13:19:29.000000Z
Duration: 00:12:14.17, start: 0.000000, bitrate: 1048 kb/s
Stream #0:0(eng): Video: hevc (Main), yuv420p(tv), 1720x720, SAR 1:1 DAR 43:18, 24 fps, 24 tbr, 1k tbn, 1k tbc (default)
Stream #0:1(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s (default)
Stream #0:2(hrv): Subtitle: subrip
Stream #0:3(cze): Subtitle: subrip
Stream #0:4(dan): Subtitle: subrip
Stream #0:5(ger): Subtitle: subrip
Stream #0:6(eng): Subtitle: subrip (default)
Stream #0:7(spa): Subtitle: subrip
Stream #0:8(fre): Subtitle: subrip
Stream #0:9(gre): Subtitle: subrip
Stream #0:10(heb): Subtitle: subrip
Stream #0:11(hun): Subtitle: subrip
Stream #0:12(ind): Subtitle: subrip
Stream #0:13(ita): Subtitle: subrip
Stream #0:14(jpn): Subtitle: subrip
Stream #0:15(dut): Subtitle: subrip
Stream #0:16(nor): Subtitle: subrip
Stream #0:17(per): Subtitle: subrip
Stream #0:18(pol): Subtitle: subrip
Stream #0:19(por): Subtitle: subrip
Stream #0:20(rus): Subtitle: subrip
Stream #0:21(chi): Subtitle: subrip
[mp4 @ 0x7fc32283b800] track 1: codec frame size is not set
Output #0, mp4, to 'tos-1720x720-cfg01.mp4':
Metadata:
encoder : Lavf58.76.100
Stream #0:0(eng): Video: hevc (Main) (hvc1 / 0x31637668), yuv420p(tv), 1720x720 [SAR 1:1 DAR 43:18], q=2-31, 24 fps, 24 tbr, 16k tbn, 1k tbc (default)
Stream #0:1(eng): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 5.1(side), fltp, 448 kb/s (default)
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 1 fps=0.0 q=-1.0 size= 0kB time=00:00:00.00 bitrate=N/A speed=N/frame=17620 fps=0.0 q=-1.0 Lsize= 94268kB time=00:12:14.00 bitrate=1052.1kbits/s speed=1.99e+03x
video:53563kB audio:40142kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.601153%
在输出文件上使用 ffprobe 我得到:
[extract_extradata @ 0x7fd9abc176c0] Invalid NAL unit 0, skipping.
[hevc @ 0x7fd9ac00b000] Invalid NAL unit 0, skipping.
[extract_extradata @ 0x7fd9abc176c0] No start code is found.
tos-1720x720-cfg01.mp4: Invalid data found when processing input
无论如何尝试使用 VLC 播放,我只能听到声音,但听不到视频。
细节:
Mac OS Big Sur: version 11.2.3 (20D91)
ffprobe version 4.4 Copyright (c) 2007-2021 the FFmpeg developers
built with Apple clang version 12.0.0 (clang-1200.0.32.29)
ffmpeg version 4.4 Copyright (c) 2000-2021 the FFmpeg developers
built with Apple clang version 12.0.0 (clang-1200.0.32.29)
答案1
从https://trac.ffmpeg.org/wiki/Encode/H.265
Final Cut 和 Apple 产品兼容性
为了使您的文件与 Apple“行业标准” H.265 兼容,您必须添加以下参数 -tag:v hvc1