FFmpeg“管道:0:处理输入时发现无效数据”TGA 文件

FFmpeg“管道:0:处理输入时发现无效数据”TGA 文件

使用 FFmpeg 将 TGA 文件处理为 MP4 文件时遇到了问题。这是我正在执行的一个版本,用于演示该问题。

ffmpeg -loglevel debug -y -r 60 -codec targa -i pipe:0 -r 60 -vf "tblend=average,framestep=2,tblend=average,framestep=2,tblend=average,framestep=2,setpts=0.125" -vcodec h264 -preset slow -crf 18 "Z:\path\to\final.mp4" < "Z:\path\to\image.tga"

出现此错误:

ffmpeg version 3.2.4 Copyright (c) 2000-2017 the FFmpeg developers built with gcc 6.3.0 (GCC) configuration: --enable-gpl --enable-version3 --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-zlib libavutil 55. 34.101 / 55. 34.101 libavcodec 57. 64.101 / 57. 64.101 libavformat 57. 56.101 / 57. 56.101 libavdevice 57. 1.100 / 57. 1.100 libavfilter 6. 65.100 / 6. 65.100 libswscale 4. 2.100 / 4. 2.100 libswresample 2. 3.100 / 2. 3.100 libpostproc 54. 1.100 / 54. 1.100 Splitting the commandline. Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'. Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'. Reading option '-r' ... matched as option 'r' (set frame rate (Hz value, fraction or abbreviation)) with argument '60'. Reading option '-codec' ... matched as option 'codec' (codec name) with argument 'targa'. Reading option '-i' ... matched as input url with argument 'pipe:0'. Reading option '-r' ... matched as option 'r' (set frame rate (Hz value, fraction or abbreviation)) with argument '60'. Reading option '-vf' ... matched as option 'vf' (set video filters) with argument 'tblend=average,framestep=2,tblend=average,framestep=2,tblend=average,framestep=2,setpts=0.125'. Reading option '-vcodec' ... matched as option 'vcodec' (force video codec ('copy' to copy stream)) with argument 'h264'. Reading option '-preset' ... matched as AVOption 'preset' with argument 'slow'. Reading option '-crf' ... matched as AVOption 'crf' with argument '18'. Reading option 'Z:\path\to\final.mp4' ... matched as output url. Finished splitting the commandline. Parsing a group of options: global . Applying option loglevel (set logging level) with argument debug. Applying option y (overwrite output files) with argument 1. Successfully parsed a group of options. Parsing a group of options: input url pipe:0. Applying option r (set frame rate (Hz value, fraction or abbreviation)) with argument 60. Applying option codec (codec name) with argument targa. Successfully parsed a group of options. Opening an input file: pipe:0. [pipe @ 0000000000727f40] Setting default whitelist 'crypto' [AVIOContext @ 0000000001fcb3e0] Statistics: 1048576 bytes read, 0 seeks pipe:0: Invalid data found when processing input

知道我做错了什么吗?谢谢!

实际执行情况:

我有一个输出TGA文件的外部程序,我想使用Java读取这些文件,将它们发送到FFmpeg,然后删除这些文件。

答案1

由于缺少 TARGA 解析器,只有固定文件大小的 TGA(即没有 RLE 压缩)可以通过管道传输到 ffmpeg。

ffmpeg -f image2pipe -framerate 60 -vcodec targa -frame_size 6220844 -i pipe:0 ... "final.mp4" < image.tga

frame_size 值应该是 TARGA 文件的文件大小(以字节为单位)。

相关内容