xinntao / Real-ESRGAN

Real-ESRGAN aims at developing Practical Algorithms for General Image/Video Restoration.
BSD 3-Clause "New" or "Revised" License
28.43k stars 3.57k forks source link

inference_realesrgan_video.py error #491

Open Ashore-lz opened 2 years ago

Ashore-lz commented 2 years ago

I get an error when I reason about the video command:python inference_realesrgan_video.py -n realesr-animevideov3 -i inputs/video/onepiece_demo.mp4 -s 2 --suffix outx2 error:[concat @ 0x12eeb00] Impossible to open 'results/onepiece_demo_out_tmp_videos/000.mp4' results/onepiece_demo_vidlist.txt: No such file or directory

bfloat16 commented 1 year ago

1.Try to download FFmpeg from https://www.gyan.dev/ffmpeg/builds/ ,and configure environment variables 2.run pip install ffmpeg-python Hope it helps you :)

PrateekPal641 commented 1 year ago

I get an error when I reason about the video command:python inference_realesrgan_video.py -n realesr-animevideov3 -i inputs/video/onepiece_demo.mp4 -s 2 --suffix outx2 error:[concat @ 0x12eeb00] Impossible to open 'results/onepiece_demo_out_tmp_videos/000.mp4' results/onepiece_demo_vidlist.txt: No such file or directory

hi could you solve this?

Enelar commented 1 year ago

python inference_realesrgan_video.py -i inputs/ -n RealESRGAN_x4plus

ffmpeg -f concat -safe 0 -i results/inputs_vidlist.txt -c copy results/inputs_out.mp4
ffmpeg version 4.3 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 7.3.0 (crosstool-NG 1.23.0.449-a04d0)
  configuration: --prefix=/opt/conda/conda-bld/ffmpeg_1597178665428/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeh --cc=/opt/conda/conda-bld/ffmpeg_1597178665428/_build_env/bin/x86_64-conda_cos6-linux-gnu-cc --disable-doc --disable-openssl --enable-avresample --enable-gnutls --enable-hardcoded-tables --enable-libfreetype --enable-libopenh264 --enable-pic --enable-pthreads --enable-shared --disable-static --enable-version3 --enable-zlib --enable-libmp3lame
  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
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
[concat @ 0x556baa161c00] Impossible to open 'results/inputs_out_tmp_videos/000.mp4'
results/inputs_vidlist.txt: No such file or directory
tejaswivg commented 1 year ago

Check whether you have torch with gpu support. torch.cuda.is_available() should return True. I have a PR which fixes these issues, but using cpu only pytorch is very slow.

therealscienta commented 1 year ago

I'm having the same issue on Debian 11 with a nVidia 1660:

[concat @ 0x55fb14d692c0] Impossible to open 'results/onepiece_demo_out_tmp_videos/000.mp4' results/onepiece_demo_vidlist.txt: No such file or directory

ffmpeg version 4.3.5-0+deb11u1 Python 3.9.2 Modules: ffmpeg==1.4 ffmpeg-python==0.2.0

torch.cuda.is_available() returns True

UPDATE:

Ok, so I changed my command from python inference_realesrgan_video.py -i inputs/video/onepiece_demo.mp4 -n weights/realesr-animevideov3 -s 2 --suffix outx2 --num_process_per_gpu 2 to just python inference_realesrgan_video.py -i inputs/video/onepiece_demo.mp4 -n realesr-animevideov3 -s 2 --suffix outx2 --num_process_per_gpu 2 and it seems to run ??

UPDATE 2: Ok, it runs, but get stuck after this message: av_interleaved_write_frame(): Broken pipe Error writing trailer of pipe:: Broken pipe would it be related?

UPDATE 3:

The Broken Pipe error seems to have happened because the VM ran out of memory. Increasing the memory or decreasing --num_process_per_gpu solved this problem.

UPDATE 4:

More testing suggest that slow storage and higher --num_process_per_gpu may cause the problem of No such file or directory. Also, a trailing / in file path will result in incorrect path sent to ffmpeg. Possible solution might be:

if args.output.endswith('/'): args.output = args.output[:-1]

kirilledition commented 1 year ago

Hello,

I recently encountered a similar issue, and I was able to resolve it by converting the mkv file to an mp4 file. Though it doesn't seem like this would directly fix your problem with the example video, it does suggest that the issue might be related to the libraries that ffmpeg was compiled with.

Here's the ffmpeg command I used to convert the mkv file to mp4: ffmpeg -i input.mkv output.mp4

Wilann commented 1 month ago

I'm getting this issue too

Command:

python inference_realesrgan_video.py --input "3_clip_00-05-46.0_00-06-14.0.mkv" --output "[4k] 3_clip_00-05-46.0_00-06-14.0.mkv"

Error:

[concat @ 0x55e03ccf0cc0] Impossible to open '[4k] 3_clip_00-05-46.0_00-06-14.0.mkv/3_clip_00-05-46.0_00-06-14.0_out_tmp_videos/000.mp4'
[4k] 3_clip_00-05-46.0_00-06-14.0.mkv/3_clip_00-05-46.0_00-06-14.0_vidlist.txt: No such file or directory

I traced the error upwards and found that my video has no nb_frames in when probing it in:

ret['nb_frames'] = int(video_streams[0]['nb_frames'])

I replaced it with the following, based on #572:

try:
    ret['nb_frames'] = int(video_streams[0]['nb_frames'])
except KeyError:
    cap = cv2.VideoCapture(video_path)
    ret['nb_frames'] = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))

Aftering fixing the nb_frames issue, I found similar issues to @therealscienta where -s 2 aka --outscale 2 removed the warning:

You are generating video that is larger than 4K, which will be very slow due to IO speed.
We highly recommend to decrease the outscale(aka, -s).

They said lowering --num_process_per_gpu fixed that issue for them, I'm using the lowest already: 1, didn't work for me.


@kirilledition's fix to convert to mp4 didn't work for me


Ended up with:

Unknown encoder 'libx264'
av_interleaved_write_frame(): Broken pipe
Error writing trailer of pipe:: Broken pipe

And still this wasn't fixed:

[concat @ 0x55ed85d1fcc0] Impossible to open '_________________'
'______________': No such file or directory

At a dead end so will probably give up on it.

Kaiser-bot commented 1 month ago

same