我有一个 mkv 视频文件,其中包含以下内容:
> mkvmerge --identify original.mkv
File 'original.mkv': container: Matroska
Track ID 0: video (V_MPEGH/ISO/HEVC)
Track ID 1: audio (AAC)
Tags for track ID 0: 7 entries
Tags for track ID 1: 7 entries
但是使用“标准”转换avconv
不起作用(ubuntu 14.04),我在其他地方找到的建议也不起作用(见下文,以及下文...)。原始文件既不能通过mplayer
连接到电视的硬盘播放,也不能从硬盘播放。
如何解决这些问题以便将文件转换为更“正常/标准”的格式,以便可以在mplayer
电视上播放?
> avconv -i original.mkv -vcodec copy -acodec aac -strict -2 -b:a 384k output.mp4
avconv version 9.18-6:9.18-0ubuntu0.14.04.1, Copyright (c) 2000-2014 the Libav developers
built on Mar 16 2015 13:19:10 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
[matroska,webm @ 0x11d3200] Unknown/unsupported AVCodecID V_MPEGH/ISO/HEVC.
[matroska,webm @ 0x11d3200] Non-increasing DTS in stream 0: packet 3 with DTS 209, packet 4 with DTS 167
[matroska,webm @ 0x11d3200] Non-increasing DTS in stream 0: packet 4 with DTS 167, packet 5 with DTS 125
[matroska,webm @ 0x11d3200] Non-increasing DTS in stream 0: packet 6 with DTS 292, packet 7 with DTS 250
[matroska,webm @ 0x11d3200] Non-increasing DTS in stream 0: packet 8 with DTS 500, packet 9 with DTS 417
[matroska,webm @ 0x11d3200] Non-increasing DTS in stream 0: packet 9 with DTS 417, packet 10 with DTS 334
[matroska,webm @ 0x11d3200] Non-increasing DTS in stream 0: packet 13 with DTS 709, packet 14 with DTS 626
[matroska,webm @ 0x11d3200] Non-increasing DTS in stream 0: packet 14 with DTS 626, packet 15 with DTS 542
[matroska,webm @ 0x11d3200] Non-increasing DTS in stream 0: packet 18 with DTS 918, packet 19 with DTS 834
[matroska,webm @ 0x11d3200] Non-increasing DTS in stream 0: packet 19 with DTS 834, packet 20 with DTS 751
[matroska,webm @ 0x11d3200] Non-increasing DTS in stream 0: packet 23 with DTS 1126, packet 24 with DTS 1043
[matroska,webm @ 0x11d3200] Non-increasing DTS in stream 0: packet 24 with DTS 1043, packet 25 with DTS 959
[matroska,webm @ 0x11d3200] Non-increasing DTS in stream 0: packet 28 with DTS 1293, packet 29 with DTS 1210
[matroska,webm @ 0x11d3200] Non-increasing DTS in stream 0: packet 29 with DTS 1210, packet 30 with DTS 1168
[matroska,webm @ 0x11d3200] Non-increasing DTS in stream 0: packet 32 with DTS 1460, packet 33 with DTS 1376
[matroska,webm @ 0x11d3200] Non-increasing DTS in stream 0: packet 33 with DTS 1376, packet 34 with DTS 1335
[matroska,webm @ 0x11d3200] Non-increasing DTS in stream 0: packet 36 with DTS 1627, packet 37 with DTS 1543
[matroska,webm @ 0x11d3200] Non-increasing DTS in stream 0: packet 37 with DTS 1543, packet 38 with DTS 1501
[matroska,webm @ 0x11d3200] Non-increasing DTS in stream 0: packet 40 with DTS 1835, packet 41 with DTS 1752
[matroska,webm @ 0x11d3200] Non-increasing DTS in stream 0: packet 41 with DTS 1752, packet 42 with DTS 1668
[matroska,webm @ 0x11d3200] Non-increasing DTS in stream 0: packet 45 with DTS 2002, packet 46 with DTS 1919
[matroska,webm @ 0x11d3200] Non-increasing DTS in stream 0: packet 46 with DTS 1919, packet 47 with DTS 1877
[matroska,webm @ 0x11d3200] Non-increasing DTS in stream 0: packet 49 with DTS 2211, packet 50 with DTS 2127
Input #0, matroska,webm, from 'original.mkv':
Duration: 00:58:38.02, start: 0.000000, bitrate: N/A
Stream #0.0: Video: [0][0][0][0] / 0x0000, 1920x1080, PAR 255:254 DAR 680:381, 23.98 fps, 23.98 tbr, 1k tbn (default)
Metadata:
BPS : 1242590
BPS-eng : 1242590
DURATION : 00:58:38.015000000
DURATION-eng : 00:58:38.015000000
NUMBER_OF_FRAMES: 84348
NUMBER_OF_FRAMES-eng: 84348
NUMBER_OF_BYTES : 546431695
NUMBER_OF_BYTES-eng: 546431695
_STATISTICS_WRITING_APP: mkvmerge v7.8.0 ('River Man') 32bit built on Mar 27 2015 16:18:02
_STATISTICS_WRITING_APP-eng: mkvmerge v7.8.0 ('River Man') 32bit built on Mar 27 2015 16:18:02
_STATISTICS_WRITING_DATE_UTC: 2016-05-16 06:10:27
_STATISTICS_WRITING_DATE_UTC-eng: 2016-05-16 06:10:27
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0.1: Audio: aac, 48000 Hz, 5.1, fltp (default)
Metadata:
BPS : 187584
BPS-eng : 187584
DURATION : 00:58:37.995000000
DURATION-eng : 00:58:37.995000000
NUMBER_OF_FRAMES: 82453
NUMBER_OF_FRAMES-eng: 82453
NUMBER_OF_BYTES : 82490002
NUMBER_OF_BYTES-eng: 82490002
_STATISTICS_WRITING_APP: mkvmerge v7.8.0 ('River Man') 32bit built on Mar 27 2015 16:18:02
_STATISTICS_WRITING_APP-eng: mkvmerge v7.8.0 ('River Man') 32bit built on Mar 27 2015 16:18:02
_STATISTICS_WRITING_DATE_UTC: 2016-05-16 06:10:27
_STATISTICS_WRITING_DATE_UTC-eng: 2016-05-16 06:10:27
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
[mp4 @ 0x11daf60] track 0: could not find tag, codec not currently supported in container
Output #0, mp4, to 'output.mp4':
Metadata:
encoder : Lavf54.20.4
Stream #0.0: Video: [0][0][0][0] / 0x0000, 1920x1080 [PAR 255:254 DAR 680:381], q=2-31, 90k tbn, 1k tbc (default)
Metadata:
BPS : 1242590
BPS-eng : 1242590
DURATION : 00:58:38.015000000
DURATION-eng : 00:58:38.015000000
NUMBER_OF_FRAMES: 84348
NUMBER_OF_FRAMES-eng: 84348
NUMBER_OF_BYTES : 546431695
NUMBER_OF_BYTES-eng: 546431695
_STATISTICS_WRITING_APP: mkvmerge v7.8.0 ('River Man') 32bit built on Mar 27 2015 16:18:02
_STATISTICS_WRITING_APP-eng: mkvmerge v7.8.0 ('River Man') 32bit built on Mar 27 2015 16:18:02
_STATISTICS_WRITING_DATE_UTC: 2016-05-16 06:10:27
_STATISTICS_WRITING_DATE_UTC-eng: 2016-05-16 06:10:27
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0.1: Audio: aac, 48000 Hz, 5.1, fltp, 384 kb/s (default)
Metadata:
BPS : 187584
BPS-eng : 187584
DURATION : 00:58:37.995000000
DURATION-eng : 00:58:37.995000000
NUMBER_OF_FRAMES: 82453
NUMBER_OF_FRAMES-eng: 82453
NUMBER_OF_BYTES : 82490002
NUMBER_OF_BYTES-eng: 82490002
_STATISTICS_WRITING_APP: mkvmerge v7.8.0 ('River Man') 32bit built on Mar 27 2015 16:18:02
_STATISTICS_WRITING_APP-eng: mkvmerge v7.8.0 ('River Man') 32bit built on Mar 27 2015 16:18:02
_STATISTICS_WRITING_DATE_UTC: 2016-05-16 06:10:27
_STATISTICS_WRITING_DATE_UTC-eng: 2016-05-16 06:10:27
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (aac -> aac)
Could not write header for output file #0 (incorrect codec parameters ?): Operation not permitted
我还尝试了以下命令:
avconv -i original.mkv -vcodec x264 -acodec aac -strict -2 -b:a 384k output.mp4
出现以下错误:
Unknown encoder 'x264'
我还尝试了以下命令:
avconv -i original.mkv -vcodec libx264 -acodec aac -strict -2 -b:a 384k output.mp4
这导致了这个错误:
[buffer @ 0x24adb00] Invalid pixel format string '-1'
Error opening filters!
答案1
只需使用最新版本的ffmpeg
。似乎的开发avconv
已经落后了。由于 mp4 容器和 HEVC 有一些变化,您的“多路复用器”必须支持它们,这可能是您在第一次尝试时得到此输出的原因:
[mp4 @ 0x11daf60] 轨道 0:无法找到标签,容器当前不支持编解码器
因为你使用的是 Ubuntu 14.04,所以你不能直接使用(适用于 Ubuntu > 14.04)进行安装ffmpeg
,sudo apt-get install ffmpeg
但你可以更新到 16.04,编译ffmpeg
从源代码编译或只安装预编译的静态构建。
安装后,您可以将 mkv“重新复用”为 mp4:
ffmpeg -i original.mkv -c:v copy output.mp4
或者将 mkv H.265 转码为 mp4 H.264:
ffmpeg -i original.mkv -c:v libx264 output.mp4
为了播放它,您需要相应的解码器(软件或硬件)。您还必须注意解码器支持哪种配置文件和级别(如果您的电视有硬件解码器)。但现在转码为 H.264 应该可以在每台电视上进行。
您可以使用甚高频液晶,韓國,GPAC MP4客户端用于播放 HEVC 内容。