视频输出速度慢,且使用的帧数比原始帧数多

视频输出速度慢,且使用的帧数比原始帧数多

所以基本上,我正在插入视频然后对其进行放大,使用流帧进行插入(RIFE Cuda)并放大real_esrgan,但是在使用ffmpeg时遇到了问题,我使用它来提取帧:

ffmpeg -i input.mp4 -qscale:v 1 -qmin 1 -qmax 1 -vsync 0 tmp_frames/frame%08d.jpg

然后使用升级器 AI,然后

此命令将放大的帧放回到一个视频

ffmpeg -i out_frames/frame%08d.jpg -i input.mp4 -vsync cfr -map 0:v:0 -map 1:a:0? -c:a copy -c:v libx264 -r 40 -pix_fmt yuv420p output_w_audio.mp4

结果通常较慢且帧数较多。

(Anaconda 日志)提取帧:

  built with gcc 10.2.1 (GCC) 20200726
  configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libgsm --enable-librav1e --disable-w32threads --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.76.100
  Duration: 00:00:01.73, start: 0.000000, bitrate: 846 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 498x280, 838 kb/s, 40 fps, 40 tbr, 10240 tbn, 80 tbc (default)
    Metadata:
      handler_name    : VideoHandler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> mjpeg (native))
Press [q] to stop, [?] for help
[swscaler @ 0000019a185e9440] deprecated pixel format used, make sure you did set range correctly
Output #0, image2, to 'tmp_frames/frame%08d.jpg':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.45.100
    Stream #0:0(und): Video: mjpeg, yuvj420p(pc), 498x280, q=1-1, 200 kb/s, 40 fps, 40 tbn, 40 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc58.91.100 mjpeg
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
frame=   69 fps=0.0 q=1.0 Lsize=N/A time=00:00:01.72 bitrate=N/A speed=6.82x
video:2684kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

将放大的帧放回原位:

  built with gcc 10.2.1 (GCC) 20200726
  configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libgsm --enable-librav1e --disable-w32threads --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Input #0, image2, from 'out_frames/frame%08d.jpg':
  Duration: 00:00:02.76, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 1992x1120, 25 fps, 25 tbr, 25 tbn, 25 tbc
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.76.100
  Duration: 00:00:01.73, start: 0.000000, bitrate: 846 kb/s
    Stream #1:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 498x280, 838 kb/s, 40 fps, 40 tbr, 10240 tbn, 80 tbc (default)
    Metadata:
      handler_name    : VideoHandler
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[swscaler @ 000001899df68740] deprecated pixel format used, make sure you did set range correctly
[libx264 @ 000001899df60b80] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX XOP FMA3 BMI1
[libx264 @ 000001899df60b80] profile High, level 5.0, 4:2:0, 8-bit
[libx264 @ 000001899df60b80] 264 - core 161 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'output_w_audio.mp4':
  Metadata:
    encoder         : Lavf58.45.100
    Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1992x1120, q=-1--1, 40 fps, 10240 tbn, 40 tbc
    Metadata:
      encoder         : Lavc58.91.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
[image2 @ 000001899d4055c0] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
frame=  111 fps= 14 q=-1.0 Lsize=    1255kB time=00:00:02.70 bitrate=3806.5kbits/s dup=42 drop=0 speed=0.351x
video:1253kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.170050%
[libx264 @ 000001899df60b80] frame I:1     Avg QP:21.58  size: 79333
[libx264 @ 000001899df60b80] frame P:32    Avg QP:22.57  size: 29435
[libx264 @ 000001899df60b80] frame B:78    Avg QP:21.28  size:  3342
[libx264 @ 000001899df60b80] consecutive B-frames:  1.8% 12.6%  2.7% 82.9%
[libx264 @ 000001899df60b80] mb I  I16..4: 19.7% 59.1% 21.2%
[libx264 @ 000001899df60b80] mb P  I16..4:  7.7% 25.3%  4.3%  P16..4: 20.0%  4.3%  2.8%  0.0%  0.0%    skip:35.6%
[libx264 @ 000001899df60b80] mb B  I16..4:  0.6%  0.7%  0.1%  B16..8: 15.2%  0.4%  0.1%  direct: 3.2%  skip:79.7%  L0:43.0% L1:55.8% BI: 1.3%
[libx264 @ 000001899df60b80] 8x8 transform intra:66.1% inter:74.1%
[libx264 @ 000001899df60b80] coded y,uvDC,uvAC intra: 19.4% 30.1% 6.6% inter: 3.0% 8.9% 0.3%
[libx264 @ 000001899df60b80] i16 v,h,dc,p: 30% 37%  7% 26%
[libx264 @ 000001899df60b80] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 28% 19% 40%  2%  2%  2%  3%  1%  2%
[libx264 @ 000001899df60b80] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 24% 20%  7%  5%  4%  5%  5%  4%
[libx264 @ 000001899df60b80] i8c dc,h,v,p: 65% 19% 14%  3%
[libx264 @ 000001899df60b80] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 000001899df60b80] ref P L0: 62.1%  9.5% 19.3%  9.1%
[libx264 @ 000001899df60b80] ref B L0: 77.9% 18.3%  3.8%
[libx264 @ 000001899df60b80] ref B L1: 95.1%  4.9%
[libx264 @ 000001899df60b80] kb/s:3695.54

任何帮助都将不胜感激!!!(图片是 anaconda 日志)提取帧][1[在此处输入图片描述

相关内容