FFmpeg "Pipe: 0: при обработке входных данных найдены неверные данные" TGA-файлы

2171
Walker Knapp

Я столкнулся с проблемой при использовании 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, а затем удаления файлов.

0
Что делает Java с файлами - просто передает их как есть? Затем добавьте `-f image2pipe` перед` -i` и замените первый `-r 60` на` -framerate 60` Gyan 6 лет назад 0
Да, он просто открывает FileInputStream и затем использует ByteStream.copy (), чтобы отправить его в канал. И с изменениями, теперь он говорит: «Выходной файл № 0 не содержит никакого потока» Walker Knapp 6 лет назад 0
Запустите команду с добавленным `-report` и загрузите сгенерированный файл журнала. Gyan 6 лет назад 0
https://pastebin.com/VMDzmVTw Walker Knapp 6 лет назад 0
Добавьте `-probesize 100M -Aanzedzeduration 100M` перед` -i` и удалите `-f h264`. Gyan 6 лет назад 0
Не изменился https://pastebin.com/i3LtUWSZ Walker Knapp 6 лет назад 0
Насколько велики TGA? Gyan 6 лет назад 0
Около 6 мегабайт Walker Knapp 6 лет назад 0

1 ответ на вопрос

2
Gyan

Из-за отсутствия парсера TARGA в ffmpeg могут быть переданы только файлы TGA фиксированного размера (т.е. без сжатия RLE).

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

Значение frame_size должно быть размером файла TARGA в байтах.