尝试解码&在我的GPU上对FFMPEG中的视频进行编码。使用此命令:
ffmpeg -y -c:v mpeg2_cuvid -vsync 0 -deint 2 -drop_second_field 1 -surfaces 10 -i 'udp://@227.10.20.149:1234?fifo_size=100000000' -map i:0x12c -r 25 -filter fps=30,scale_npp=640:360:format=same:interp_algo=lanczos -aspect 16:9 -g 96 -vcodec h264_nvenc -b 400K -minrate 400k -maxrate 400k -f mpegts 'udp://@239.0.0.12:1000?overrun_nonfatal_option=1'
但是FFMPEG仍然给我这个输出:
Using -vsync 0 and -r can produce invalid output files
Stream mapping:
Stream #0:8 -> #0:0 (mpeg2video (mpeg2_cuvid) -> h264 (h264_nvenc))
Stream #0:8 -> #1:0 (mpeg2video (mpeg2_cuvid) -> h264 (h264_nvenc))
Stream #0:8 -> #2:0 (mpeg2video (mpeg2_cuvid) -> h264 (h264_nvenc))
Stream #0:8 -> #3:0 (mpeg2video (mpeg2_cuvid) -> h264 (h264_nvenc))
Stream #0:9 -> #4:0 (mp2 (native) -> aac (native))
Stream #0:10 -> #5:0 (mp2 (native) -> aac (native))
Press [q] to stop, [?] for help
[mpegts @ 0x55c260173b20] frame size not set
Output #5, mpegts, to 'udp://@239.0.0.12:1005?overrun_nonfatal_option=1':
Metadata:
encoder : Lavf57.83.100
Stream #5:0(eng): Audio: aac (LC), 48000 Hz, stereo, fltp, 128 kb/s
Metadata:
encoder : Lavc57.107.100 aac
[mpegts @ 0x55c260172560] frame size not set
Output #4, mpegts, to 'udp://@239.0.0.12:1004?overrun_nonfatal_option=1':
Metadata:
encoder : Lavf57.83.100
Stream #4:0(por): Audio: aac (LC), 48000 Hz, stereo, fltp, 128 kb/s
Metadata:
encoder : Lavc57.107.100 aac
Impossible to convert between the formats supported by the filter 'Parsed_fps_0' and the filter 'auto_scaler_0'
Error reinitializing filters!
Failed to inject frame into filter network: Function not implemented
Error while processing the decoded data for stream #0:8
[aac @ 0x55c260173020] Qavg: 347.777
[aac @ 0x55c260173020] 2 frames left in the queue on closing
[aac @ 0x55c260174ac0] Qavg: 339.059
[aac @ 0x55c260174ac0] 2 frames left in the queue on closing
Conversion failed!
我的FFMPEG版本:
ffmpeg version n3.4.2-9-ga877ab75eb Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
configuration: --enable-libzvbi --enable-libnpp --enable-cuda --enable-cuvid --enable-nvenc --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64 --enable-gpl --enable-libx264 --disable-x86asm --enable-libx265 --enable-libfdk-aac --enable-nonfree
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
Use -h to get full help or, even better, run 'man ffmpeg'
我尝试将输出编解码器更改为hevc_nvenc,nvenc_hevc(均可从Nvidia获得),但仍然出现此错误。我做错了什么? 谢谢你的提示。