Thank you for this! How can we use hevc_videotoolbox instead of libx264 for ffmpeg? This will use hardware acceleration on Apple Silicon Macs (m1 and m2). I just tried swaping them out in the commandline but it appears to not work - I just get a non-working mp4.
I don’t have an Apple Silicon Mac to test on (that was a loaner), however the ffmpeg part is just breaking down the video and recombining the upscaled images. That part runs fairly fast so I am not sure overall you would gain a lot of time. However hopefully someone can help out with the hardware acceleration in ffmpeg - faster is faster
@@freewarefocus I was able to figure it out using x264 instead. The encoding is sped up dramatically: 3-4minutes vs 12-14 minutes on a Macbook Pro M1. My final command using a bitrate of 1750k is: ffmpeg -framerate 23.976025 -thread_queue_size 4096 -i scaled/frame%06d.png -i video/audio.mp3 -c:v h264_videotoolbox -b:v 1750k -r 23.976025 video/out.mp4 I can't figure out how to use hevc_videotoolbox (x265) t convert png frames though other than using a 2-step process but convert the frames to x265 and then converting that output to x265. But because the Apple Silicon has 264/265 acceleration it is still faster than non-accelerated.
Thank you Sir !the last command was giving me error, I changed it to this "./ffmpeg -f image2 -framerate 23.96 -i scaled/frame%06d.png -i video/audio.mp3 -r 23.96 -vcodec libx264 -crf 16 video/upscaled.mp4 "
Hello! I'm upscaling a 3 minute video (~5000 frames), and it’s taking a long time, and my computer auto shut off. Would that have interrupted the process or will it still be running?
My video finally finished scaled after three days. Only issue is, it’s now saying "This format is not compatible with Quickplayer". I can play it anyways, but it only plays the audio, no picture. It's a .mov, but I already have multiple .mov's saved to my photos app. Other than video title and frame rate, I followed the instructions letter for letter, so I’m not sure what’s going on. Here’s the command I used, is it missing anything? ./ffmpeg -f image2 -framerate 30 -i scaled/frames%07d.png -i video/audio.mp3 -r 30 -vcodec libx264 -crf 11 video/upscaled.mp4 I double checked and it saved all 5000+ frames to the upscaled folder, and saved the audio to the "video" folder.
Offhand I would guess that ffmepg can't handle MOVs very well. However you should have a MP3 file in the directory with the resulting video. I would bring it into an editor and recombine them. Then re-encode it to attach the video and get it into a more standard format. Free options for video editors include Kdenlive and Davinci Resolve.
Solved!!! The problem is that the output video is not read. Guys, here's a new order of commands, since what the author gives is not readable in the output, use it! I took this from the Realgun repository. cd /Users/lilneo/Desktop/Wifu2x ./ffprobe video/video.mp4 ./ffmpeg -i video/video.mp4 -qscale:v 1 -qmin 1 -qmax 1 -vsync 0 frames/frame%06d.png ./waifu2x-ncnn-vulkan -i frames/ -o scaled/ -n 2 -s 2 ./ffmpeg -i scaled/frame%06d.png -i video/video.mp4 -map 0:v:0 -map 1:a:0 -c:a copy -c:v libx264 -r 24 -pix_fmt yuv420p video/upscaled.mp4
@@staschye458 Thanks a lot, that really worked for me. Only thing was my video didn't have audio so I had to remove the "-map 1:a:0" line because it was giving an error
Hello, I tried following your guide, it's clearly mentioned. Howevever I am stuck her. When I try to scale the images with ./waifu2x-ncnn-vulkan -i frames/ -o scaled/ -n 2 -s 2, it's stuck forever, just not completing. I have just 556 frames. Could you please help?
What Mac hardware and OS version are you on? Also try adding to the command line "-g -1" (no quotes) - that will force it to use the CPU instead of the GPU. It likely would be very slow but may make it functional at least
@@freewarefocus Sorry for the delayed response here. I am on Mac Ventura 13.4.1 with 16GB. Btw it worked for me after restarting and waiting a little longer. But I didn't really notice much upscaling so kind of uninstalled it . Thank you!
@@Aiuniqreate Glad it finally completed. Sorry it didn't work out for you, sometimes it has really great results and sometimes it is a bit meh - just depends on the video
I wished on using realesrgan because it it said to be the best could you please guide with that it is available for Mac but I couldn't find any relevant video on RUclips that could help me @@freewarefocus
Ah man it was going so well I followed very instruction but the last input in terminal I just get ' error option r35 Error splitting the argument list: invalid argument. I spent an hour for 726 frames. everything is in the right folder frame and upscale etc but I did get an error message when upscaling after code line ./waifu2x-ncnn-vulkan -i frames/ -o scaled/ -n 2 -s 2 [out#0/image2 @ 0x7f82a0017700] video:505212KiB audio:0KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknown frame= 726 fps=169 q=-0.0 Lsize=N/A time=00:00:29.04 bitrate=N/A speed=6.77x ben@Mac-Studio waifu2x % ./waifu2x-ncnn-vulkan -i frames/ -o scaled/ -n 2 -s 2 both .DS_Store and output .png ! .DS_Store will output .DS_Store.png [0 Apple M2 Max] queueC=0[1] queueG=0[1] queueT=0[1] [0 Apple M2 Max] bugsbn1=0 bugbilz=97 bugcopc=0 bugihfa=0 [0 Apple M2 Max] fp16-p/s/a=1/1/1 int8-p/s/a=1/1/1 [0 Apple M2 Max] subgroup=32 basic=1 vote=1 ballot=1 shuffle=1 decode image frames//.DS_Store failed it then took quite a while to make the .png which is strange as im using a Mac Studio M@ ultra with 64GB RAM Any help much appreciate its a family film from the 90s love to make one bit of it work well., Do you think it was too short of have I gone wrong somewhere I copied an pasted everything from your description setting looks good though hope I can get it to work cheers
Thank you I will try again. The original video has been converted from VOB to mp4 through wondershare so I may try running it through handbrake or a similar program. I’m just very busy till 25th Feb so I’ll try again then. Just want to make a nice little upgrade of a video of me when I was 5 back in 1991 so it’s very old vhs that’s been moved to dvd then burnt to .VOB then converted again. Poor video probably doesn’t know what’s going on. Would you recommend any specific settings for wonder share that might help like changing the fps or the H264 etc there so many settings I can tweak I just went with what it offered without looking much further, but I appreciate your help. I will look into it as soon as I get some time. I haven’t really used terminal before so I was quite impressed that I got any of it working.
running into the same problem. did you get it to work? also couldnt i extract the video file to pngs through a different program or is it necessary to use this method
@@Gtexport You can use any method that takes a video and spits out PNGs of the frames. In fact, in this video I show how to use Shotcut (free, open source & avail for the Mac) to do that via a GUI: ruclips.net/video/QdYdq3xO7-k/видео.htmlsi=cmMs1GjA0ejskdhb
Guessing but I suspect you might have typed in -1 frames instead of -i frames as part of the command line. -i is for input, -o is for output, -n is for noise and -s is for scaling - you basically just use the first, lower case letter for each option
It looks like this could be a directory or naming issue according to a bug report coder.social/nihui/waifu2x-ncnn-vulkan/issues/160 . Make sure you aren't renaming anything and are executing the program in the same directory.
worked like a charm on first try. Thanks a lot, really appreciate it!
Thank you so much! You really helped me today!!
I love my waifu2x
Thanks! Works!
Thank you for this! How can we use hevc_videotoolbox instead of libx264 for ffmpeg? This will use hardware acceleration on Apple Silicon Macs (m1 and m2). I just tried swaping them out in the commandline but it appears to not work - I just get a non-working mp4.
I don’t have an Apple Silicon Mac to test on (that was a loaner), however the ffmpeg part is just breaking down the video and recombining the upscaled images. That part runs fairly fast so I am not sure overall you would gain a lot of time. However hopefully someone can help out with the hardware acceleration in ffmpeg - faster is faster
@@freewarefocus I was able to figure it out using x264 instead. The encoding is sped up dramatically: 3-4minutes vs 12-14 minutes on a Macbook Pro M1. My final command using a bitrate of 1750k is: ffmpeg -framerate 23.976025 -thread_queue_size 4096 -i scaled/frame%06d.png -i video/audio.mp3 -c:v h264_videotoolbox -b:v 1750k -r 23.976025 video/out.mp4
I can't figure out how to use hevc_videotoolbox (x265) t convert png frames though other than using a 2-step process but convert the frames to x265 and then converting that output to x265. But because the Apple Silicon has 264/265 acceleration it is still faster than non-accelerated.
Thank you Sir !the last command was giving me error, I changed it to this "./ffmpeg -f image2 -framerate 23.96 -i scaled/frame%06d.png -i video/audio.mp3 -r 23.96 -vcodec libx264 -crf 16 video/upscaled.mp4
"
THANK YOU SO MUCHHHHH! Bless your heart! I was facing the same error :)
This too also worked for me - unlike the command in the description. Thank you
Hello! I'm upscaling a 3 minute video (~5000 frames), and it’s taking a long time, and my computer auto shut off. Would that have interrupted the process or will it still be running?
If it is just sleeping it should resume. If it stopped running in the terminal window (or the window closed) it likely isn’t running in the background
@@freewarefocus Thanks!
Great video. Can you upload and link the txt file with all the prompt names of the code you're entering? Thank you.
All of the commands are in the video description so you can copy them from there and past them into a text document.
My video finally finished scaled after three days. Only issue is, it’s now saying "This format is not compatible with Quickplayer". I can play it anyways, but it only plays the audio, no picture. It's a .mov, but I already have multiple .mov's saved to my photos app. Other than video title and frame rate, I followed the instructions letter for letter, so I’m not sure what’s going on. Here’s the command I used, is it missing anything?
./ffmpeg -f image2 -framerate 30 -i scaled/frames%07d.png -i video/audio.mp3 -r 30 -vcodec libx264 -crf 11 video/upscaled.mp4
I double checked and it saved all 5000+ frames to the upscaled folder, and saved the audio to the "video" folder.
Offhand I would guess that ffmepg can't handle MOVs very well. However you should have a MP3 file in the directory with the resulting video. I would bring it into an editor and recombine them. Then re-encode it to attach the video and get it into a more standard format. Free options for video editors include Kdenlive and Davinci Resolve.
Solved!!! The problem is that the output video is not read. Guys, here's a new order of commands, since what the author gives is not readable in the output, use it! I took this from the Realgun repository.
cd /Users/lilneo/Desktop/Wifu2x
./ffprobe video/video.mp4
./ffmpeg -i video/video.mp4 -qscale:v 1 -qmin 1 -qmax 1 -vsync 0 frames/frame%06d.png
./waifu2x-ncnn-vulkan -i frames/ -o scaled/ -n 2 -s 2
./ffmpeg -i scaled/frame%06d.png -i video/video.mp4 -map 0:v:0 -map 1:a:0 -c:a copy -c:v libx264 -r 24 -pix_fmt yuv420p video/upscaled.mp4
@@staschye458 Thanks a lot, that really worked for me. Only thing was my video didn't have audio so I had to remove the "-map 1:a:0" line because it was giving an error
How do you play the videos on Mac? I keep getting error saying formate isn’t supported by QuickTime Player
Hello, I tried following your guide, it's clearly mentioned. Howevever I am stuck her. When I try to scale the images with ./waifu2x-ncnn-vulkan -i frames/ -o scaled/ -n 2 -s 2, it's stuck forever, just not completing. I have just 556 frames. Could you please help?
What Mac hardware and OS version are you on? Also try adding to the command line "-g -1" (no quotes) - that will force it to use the CPU instead of the GPU. It likely would be very slow but may make it functional at least
@@freewarefocus Sorry for the delayed response here. I am on Mac Ventura 13.4.1 with 16GB. Btw it worked for me after restarting and waiting a little longer. But I didn't really notice much upscaling so kind of uninstalled it . Thank you!
@@Aiuniqreate Glad it finally completed. Sorry it didn't work out for you, sometimes it has really great results and sometimes it is a bit meh - just depends on the video
perfect.
Hello wich Mac are you using ? thx
That is an M1 iMac with 8 gigs of RAM
@@freewarefocus Do you think if it’s could be possible to do this on a MacBook Air M2 ?
@@PixelPop_Officiel I would totally expect it to work, just even faster than the M1
@@freewarefocus i wondering this vecaus there is no fans on the MaBoik Air M2
it said incompatable driver
nah! you've got to be friggin kidding me with this mess
You can use out this all GUI method for Mac here: ruclips.net/video/QdYdq3xO7-k/видео.htmlsi=LxIwx81rTiSyzq1J
will it work with apple m series?
This video was recorded on an M1 Mac so it should work fine
I wished on using realesrgan because it it said to be the best could you please guide with that it is available for Mac but I couldn't find any relevant video on RUclips that could help me
@@freewarefocus
/ffmpeg -f image2 -f image2 -framefate 23.98 -i scaled/frame%06d.png -i video/audio.mp3 -r 23.98 -vcodec libx264 -crf 16 video/upscaled.mp4
Unrecognized option 'framefate'.
Error splitting the argument list: Option not found
Any ideas?
That option is frame*r*ate (framerate) and not framefate. That should fix it.
@@freewarefocus oops looool
Ah man it was going so well I followed very instruction but the last input in terminal I just get ' error option r35
Error splitting the argument list: invalid argument. I spent an hour for 726 frames. everything is in the right folder frame and upscale etc but I did get an error message when upscaling after code line
./waifu2x-ncnn-vulkan -i frames/ -o scaled/ -n 2 -s 2
[out#0/image2 @ 0x7f82a0017700] video:505212KiB audio:0KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknown
frame= 726 fps=169 q=-0.0 Lsize=N/A time=00:00:29.04 bitrate=N/A speed=6.77x
ben@Mac-Studio waifu2x % ./waifu2x-ncnn-vulkan -i frames/ -o scaled/ -n 2 -s 2
both .DS_Store and output .png ! .DS_Store will output .DS_Store.png
[0 Apple M2 Max] queueC=0[1] queueG=0[1] queueT=0[1]
[0 Apple M2 Max] bugsbn1=0 bugbilz=97 bugcopc=0 bugihfa=0
[0 Apple M2 Max] fp16-p/s/a=1/1/1 int8-p/s/a=1/1/1
[0 Apple M2 Max] subgroup=32 basic=1 vote=1 ballot=1 shuffle=1
decode image frames//.DS_Store failed
it then took quite a while to make the .png which is strange as im using a Mac Studio M@ ultra with 64GB RAM
Any help much appreciate its a family film from the 90s love to make one bit of it work well., Do you think it was too short of have I gone wrong somewhere I copied an pasted everything from your description setting
looks good though hope I can get it to work
cheers
I am not sure I haven't see that before. I would check to make sure the images are actually valid and no are zero bytes or something.
Thank you I will try again. The original video has been converted from VOB to mp4 through wondershare so I may try running it through handbrake or a similar program. I’m just very busy till 25th Feb so I’ll try again then. Just want to make a nice little upgrade of a video of me when I was 5 back in 1991 so it’s very old vhs that’s been moved to dvd then burnt to .VOB then converted again. Poor video probably doesn’t know what’s going on. Would you recommend any specific settings for wonder share that might help like changing the fps or the H264 etc there so many settings I can tweak I just went with what it offered without looking much further, but I appreciate your help. I will look into it as soon as I get some time. I haven’t really used terminal before so I was quite impressed that I got any of it working.
running into the same problem. did you get it to work?
also couldnt i extract the video file to pngs through a different program or is it necessary to use this method
@@Gtexport You can use any method that takes a video and spits out PNGs of the frames. In fact, in this video I show how to use Shotcut (free, open source & avail for the Mac) to do that via a GUI: ruclips.net/video/QdYdq3xO7-k/видео.htmlsi=cmMs1GjA0ejskdhb
I get the following for my .avi file (after over 1,090 png "frames" were generated):
./waifu2x-ncnn-vulkan: illegal option -- 1
Is this fixable?
Guessing but I suspect you might have typed in -1 frames instead of -i frames as part of the command line. -i is for input, -o is for output, -n is for noise and -s is for scaling - you basically just use the first, lower case letter for each option
/waifu2x/models-cunet/noise2_scale2.0x_model.bin failed
zsh: segmentation fault ./waifu2x-ncnn-vulkan -i frames/ -o scaled/ -n 2 -s 2
It looks like this could be a directory or naming issue according to a bug report coder.social/nihui/waifu2x-ncnn-vulkan/issues/160 . Make sure you aren't renaming anything and are executing the program in the same directory.