You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

MKV文件头部存在空字节导致无法识别及音频提取失败的求助

MKV文件头部存在空字节导致无法识别及音频提取失败的求助

最近我下载了一个.mkv格式的电影,在Android端的VLC上播放完全没问题,但用adb pull把文件传到电脑后,不管是mpv(提示Failed to recognize file format)还是parole(GStreamer后端报错:Could not determine the type of file)都打不开,就连Windows上的VLC也一直在加载,完全播放不了。

我用的传输命令是:

adb pull /storage/0123-4567/Movies/Video.mkv ~/Movies/

我用bless编辑器查看文件的魔数,想确认是不是标准的Matroska格式,结果发现文件开头全是空字节。用cmp Video.mkv /dev/zero对比后,显示两个文件在第170393601字节(对应第1行)开始出现差异。

我还试过用FFmpeg提取其中一条音轨,命令和输出如下:

$ ffmpeg -i Video.mkv -map 0:a:1 -acodec copy output.mka -loglevel trace

ffmpeg version 5.1.3 Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 12 (GCC)
configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --docdir=/usr/share/doc/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' --extra-ldflags='-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 ' --extra-cflags=' -I/usr/include/rav1e' --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-version3 --enable-bzlib --enable-chromaprint --disable-crystalhd --enable-fontconfig --enable-frei0r --enable-gcrypt --enable-gnutls --enable-ladspa --enable-libaom --enable-libdav1d --enable-libass --enable-libbluray --enable-libbs2b --enable-libcdio --enable-libdrm --enable-libjack --enable-libjxl --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libilbc --enable-libmp3lame --enable-libmysofa --enable-nvenc --enable-openal --enable-opencl --enable-opengl --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-libplacebo --enable-librsvg --enable-librav1e --enable-librubberband --enable-libsmbclient --enable-version3 --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-version3 --enable-vapoursynth --enable-libvpx --enable-vulkan --enable-libshaderc --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libxml2 --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-avfilter --enable-libmodplug --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-lto --enable-libmfx --enable-runtime-cpudetect
libavutil 57. 28.100 / 57. 28.100
libavcodec 59. 37.100 / 59. 37.100
libavformat 59. 27.100 / 59. 27.100
libavdevice 59. 7.100 / 59. 7.100
libavfilter 8. 44.100 / 8. 44.100
libswscale 6. 7.100 / 6. 7.100
libswresample 4. 7.100 / 4. 7.100
libpostproc 56. 6.100 / 56. 6.100
Splitting the commandline.
Reading option '-i' ... matched as input url with argument 'Video.mkv'.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '0:a:1'.
Reading option '-acodec' ... matched as option 'acodec' (force audio codec ('copy' to copy stream)) with argument 'copy'.
Reading option 'output.mka' ... matched as output url.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'trace'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument trace.
Successfully parsed a group of options.
Parsing a group of options: input url Video.mkv.
Successfully parsed a group of options.
Opening an input file: Video.mkv.
[NULL @ 0x55f512f8f200] Opening 'Video.mkv' for reading
[file @ 0x55f512f8fa00] Setting default whitelist 'file,crypto,data'
[matroska,webm @ 0x55f512f8f200] Format matroska,webm detected only with low score of 1, misdetection possible!
[matroska,webm @ 0x55f512f8f200] 0x00 at pos 0 (0x0) invalid as first byte of an EBML number
[matroska,webm @ 0x55f512f8f200] EBML header parsing failed
[AVIOContext @ 0x55f512f97dc0] Statistics: 1048576 bytes read, 0 seeks
Video.mkv: Invalid data found when processing input

后来我换成USB连接,用系统文件管理器手动拷贝文件,结果还是一样的报错。

我的目标是能从这个MKV里提取音频,同时让mpv能正常播放这个文件,有没有大佬能给点建议呀?

备注:内容来源于stack exchange,提问作者WMunn

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.22 12:19:39