Djdefrag / QualityScaler

QualityScaler - image/video AI upscaler app
MIT License
2.1k stars 156 forks source link

Upscaling doesnt work, gives me this error, how do i fix this? (input file is .mp4 and everything looks fine) #104

Open nevolua opened 2 months ago

nevolua commented 2 months ago

[QualityScaler] Preference file exist Loading AI model Upscaling from scrach

  1. Extracting video audio Frames supported simultaneously by GPU: 47
  2. Upscaling video
  3. Upscaling video (6 threads)
  4. Upscaling video 5.76% (06s)
  5. Upscaling video 11.51% (04s)
  6. Upscaling video 17.27% (03s)
  7. Upscaling video 23.02% (02s)
  8. Upscaling video 28.78% (02s)
  9. Upscaling video 34.53% (02s)
  10. Upscaling video 40.29% (01s)
  11. Upscaling video 46.04% (01s)
  12. Upscaling video 51.80% (01s)
  13. Upscaling video 57.55% (01s)
  14. Upscaling video 63.31% (01s)
  15. Upscaling video 69.06% (01s)
  16. Processing upscaled video Error [Errno 22] Invalid argument

MoviePy error: FFMPEG encountered the following error while writing file C:/Users/Ben/Downloads/test_RealESR_Gx4_Resize-100_Interpolation-Low.mp4:

b'[mp4 @ 000001deccbcdc00] Could not find tag for codec pcm_s16le in stream #1, codec not currently supported in container\r\nCould not write header for output file #0 (incorrect codec parameters ?): Invalid argument\r\nError initializing output stream 0:0 -- \r\n'

The video export failed, possibly because the codec specified for the video (libx264) is not compatible with the given extension (mp4). Please specify a valid 'codec' argument in write_videofile. This would be 'libx264' or 'mpeg4' for mp4, 'libtheora' for ogv, 'libvpx for webm. Another possible reason is that the audio codec was not compatible with the video codec. For instance the video extensions 'ogv' and 'webm' only allow 'libvorbis' (default) as avideo codec.

Djdefrag commented 2 months ago

Hi my friend,

you need the newer version of ffmpeg.

  1. Go to this site (https://www.gyan.dev/ffmpeg/builds/)
  2. Download one of this zip 365366956-6bbc7c1a-92ba-498c-9e02-fd858d2ba32b
  3. Extract ffmpeg.exe from the downloaded .zip
  4. Copy ffmpeg.exe to QualityScaler/Assets
eulisan commented 1 month ago

Does not work for me, getting the same error with newest ffmpeg. But when i delete the audiofile from the "working" directory where also the frames and scaled images are stored, it works.

Seems it cant process the audio into the video for me.

Dodeedoo commented 1 month ago

Does not work for me, getting the same error with newest ffmpeg. But when i delete the audiofile from the "working" directory where also the frames and scaled images are stored, it works.

Seems it cant process the audio into the video for me.

you are correct, it is an issue with incorrect audio codec being used to save the video

add audio_codec='pcm_32le' replace 32 with bit depth of saved wav audio from your video

Djdefrag commented 1 month ago

@Dodeedoo @eulisan @nevolua Hi my friends

just released an update that fix this problem, let me know if it works

eulisan commented 1 month ago

Uhm, well. I used RealScaler which did extract the audio and had the same error. But i think it used external FFMPEG and i didnt had exiftool in the Asset Directory.

Now i placed FFMPEG and EXIFTOOL in the Asset Directory and using the 3.10 Qualityscaler it does work, but without audio. Means, i wont extract the audio.wav

But Realscaler 3.9 now works for me, lol.

Djdefrag commented 1 month ago

Exiftool only extract original file metadata (so it's not about audio)

With QualityScaler 3.10 the app does not extract the audio as file, but use FFMPEG to copy the audio from original video to upscaled video. This function is called Audio Passthrough