hzwer / ECCV2022-RIFE

ECCV2022 - Real-Time Intermediate Flow Estimation for Video Frame Interpolation
MIT License
4.32k stars 430 forks source link

Errors with `inference_video.py` (audio issues?) #184

Closed DePasqualeOrg closed 2 years ago

DePasqualeOrg commented 3 years ago

I get the following errors when I run inference_video.py. It seems to be an issue with a missing audio track. Does anyone know how to solve this?

(base) root@<REDACTED>:/notebooks/frame_interpolation/arXiv2020-RIFE# python inference_video.py --exp=3 --video=video.mp4 --output=output.mp4
Loaded v3.x HD model.
video.mp4, 295.0 frames in total, 29.85767000527148FPS to 238.86136004217184FPS
The audio will be merged after interpolation process
[mpeg4 @ 0x555bd60055c0] timebase 1000/238861 not supported by MPEG 4 standard, the maximum admitted value for the timebase denominator is 65535
[ERROR:0] global /tmp/pip-req-build-3umofm98/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp (2774) open Could not open codec mpeg4, error: Unspecified error
[ERROR:0] global /tmp/pip-req-build-3umofm98/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp (2791) open VIDEOIO/FFMPEG: Failed to initialize VideoWriter
 90%|███████████████████████████████████████████████████████▋      | 265/295.0 [01:03<00:07,  4.15it/s]
ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
  configuration: --prefix=/usr --extra-version=1ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 1
    compatible_brands: isommp41mp42
    creation_time   : 2021-07-19T18:19:01.000000Z
  Duration: 00:00:08.87, start: 0.000000, bitrate: 5980 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 592x592, 5363 kb/s, 29.86 fps, 30 tbr, 15360 tbn, 60 tbc (default)
    Metadata:
      creation_time   : 2021-07-19T18:19:01.000000Z
      handler_name    : Core Media Video
Output #0, matroska, to './temp/audio.mkv':
Output file #0 does not contain any stream
Audio transfer failed. Interpolated video will have no audio
Traceback (most recent call last):
  File "/notebooks/frame_interpolation/arXiv2020-RIFE/inference_video.py", line 269, in <module>
    transferAudio(args.video, vid_out_name)
  File "/notebooks/frame_interpolation/arXiv2020-RIFE/inference_video.py", line 34, in transferAudio
    os.rename(targetVideo, targetNoAudio)
FileNotFoundError: [Errno 2] No such file or directory: 'output.mp4' -> 'output_noaudio.mp4'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/notebooks/frame_interpolation/arXiv2020-RIFE/inference_video.py", line 273, in <module>
    os.rename(targetNoAudio, vid_out_name)
FileNotFoundError: [Errno 2] No such file or directory: 'output_noaudio.mp4' -> 'output.mp4'
hzwer commented 3 years ago

[mpeg4 @ 0x555bd60055c0] timebase 1000/238861 not supported by MPEG 4 standard, the maximum admitted value for the timebase denominator is 65535

hzwer commented 3 years ago

you may set --fps to control the frame rate

DePasqualeOrg commented 3 years ago

Setting the fps flag fixed the issue, thanks! However, that error message regarding the timebase is hidden in a lot of output, and it's not obvious to me as a new user that the real error is due to the fps setting. Is there any way the default behavior could be made more intuitive and error-avoidant?