ffmpeg.js使用 FFmpeg 的自定义构建来保持其较小的大小。我正在尝试将 a 转换.ts
为 a .mp4
,这在我的桌面上一直是一件容易的事(特别是因为它们甚至使用相同的编解码器、aac 和 h.264),但是在自定义构建中,我得到了错误sample1.ts: Invalid data found when processing input
。
正在运行的命令是ffmpeg -i sample1.ts -report -c copy out.mp4
.
我在这个主题上看到的其他问题超出了对输入文件的初始阅读,我找不到关于我的问题是什么或如何解决它的好资源。
这是一个相当不起眼的错误,所以我不确定到底是什么问题。我认为这意味着此构建不支持ts
文件,但我什至不确定这在编解码器和多路复用器方面意味着什么。
从自定义构建文件中,启用的解复用器和解码器是
COMMON_DEMUXERS = matroska ogg mov mp3 wav image2 concat
COMMON_DECODERS = vp8 h264 vorbis opus mp3 aac pcm_s16le mjpeg png
这些用于--enable-demuxer
和--enable-decoder
标志。
我在解码器中看到了 h264 和 aac,所以我不明白为什么会有编解码器问题。
它确实适用于某些文件类型,因此问题不是构建本身。
我曾尝试添加解复用器和解码器之类mpeg2
的,但这只是为我赢得了WARNING: Option --enable-decoder=mpeg2 did not match anything
.
我使用-report
标志时的完整输出是
./this.program -i sample1.ts -report -c copy out.mp4
ffmpeg version n4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
built with emcc (Emscripten gcc/clang-like replacement) 1.39.11
configuration: --cc=emcc --ranlib=emranlib --enable-cross-compile --target-os=none --arch=x86 --disable-runtime-cpudetect --disable-asm --disable-fast-unaligned --disable-pthreads --disable-w32threads --disable-os2threads --disable-debug --disable-stripping --disable-safe-bitstream-reader --disable-all --enable-ffmpeg --enable-avcodec --enable-avformat --enable-avfilter --enable-swresample --enable-swscale --disable-network --disable-d3d11va --disable-dxva2 --disable-vaapi --disable-vdpau --enable-decoder=vp8 --enable-decoder=h264 --enable-decoder=vorbis --enable-decoder=opus --enable-decoder=mp3 --enable-decoder=aac --enable-decoder=pcm_s16le --enable-decoder=mjpeg --enable-decoder=png --enable-demuxer=matroska --enable-demuxer=ogg --enable-demuxer=mov --enable-demuxer=mp3 --enable-demuxer=wav --enable-demuxer=image2 --enable-demuxer=concat --enable-protocol=file --enable-filter=aresample --enable-filter=scale --enable-filter=crop --enable-filter=overlay --enable-filter=hstack --enable-filter=vstack --dis libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavfilter 7. 57.100 / 7. 57.100
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
Splitting the commandline.
Reading option '-i' ... matched as input url with argument 'sample1.ts'.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Reading option '-c' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option 'out.mp4' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url sample1.ts.
Successfully parsed a group of options.
Opening an input file: sample1.ts.
[NULL @ 0x72c300] Opening 'sample1.ts' for reading
[file @ 0x72c9f0] Setting default whitelist 'file,crypto'
[AVIOContext @ 0x734ab0] Statistics: 448192 bytes read, 0 seeks
sample1.ts: Invalid data found when processing input