
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 파일의 파일 크기(바이트)여야 합니다.