I'm encoding some videos with ffmpeg, if I use only CPU the speed it's about 1x, so as I have an AMD RX580 I tried with amd encoding, but only increased the speed to 1.5x. Is this ok? Should it go faster?
My command is:
ffmpeg -i 5.mp4 -c:v h264_amf -lavfi "[0:v]scale=1920:1080,boxblur=luma_radius=min(h\,w)/8:luma_power=1:chroma_radius=min(cw\,ch)/8:chroma_power=1[bg];[0:v]scale=-1:1080[ov];[bg][ov]overlay=(W-w)/2:(H-h)/2,crop=w=1920:h=1080" output.mp4
Can I do anything to increase the speed?
Thanks
Related
I am on Fedora 37, version is irrelevant as I had same issue on Fedora 36.
I am using the following command to send video from my usb video card to v4l2loopback and the CPU usage goes to 100% and I can't do much more on my computer (i5-8600k, nvidia 2060 rtx, 16GB ram).
ffmpeg -nostdin -threads 1 -f video4linux2 -video_size 1920x1080 -input_format mjpeg -i /dev/video1 -f v4l2 -preset fast -c:v copy /dev/video0
previously the command was like that and the rest of the arguments was added to see if it makes any difference, it seems it doesn't change much
ffmpeg -f video4linux2 -video_size 1920x1080 -input_format mjpeg -i /dev/video1 -f v4l2 -c copy /dev/video0
To be honest I don't know much about ffmpeg or video in general, I was using the same command a few months ago on the same hardware with almost 0 impact to my performance, I could play games and watch videos at the same time while now I get 15 FPS in my games while I am using ffmpeg. Did anything change in ffmpeg? Any improvements to my ffmpeg command? Shouldn't ffmpeg not encode anything if I am using pixelformat and frame rate supported by my usb video card and if that is true shouldn't be super light?
I download cuda driver for my nvidia
but it still does not use my GPU, it still using cpu.
how can i make it use GPU.
i heard about hardware acceleration as well but thats not working.
It has to be h.264
Your question is not very clear.
From what I have read, it looks like you are trying to do h.264 encoding using your Nvidia GPU card.
Try this command and add your other codec or change the codec you use.
But usually, this will encode a file you have to mp4 using GPU.
ffmpeg -hwaccel cuvid -i input.mp4 -c:v h264_nvenc -pix_fmt yuv420p -preset slow output.mp4
I am encoding videos from h264 to h265 using ffmpeg. First I used the x265 software version for a 30 sec movie clip reducing the file size from 18Mb to 2Mb and got the following still-frame result in 45 sec
Next I used the hevc_videotoolbox hardware accelerated version, first going from 18 to 1.6 Mb and the results were so poor I decided to up the bitrate to 1.5Mbit/s, thus getting a 5.7Mb file in 12 sec. However, the result is clearly inferior to the x265 version despite the almost 3x increase in filesize.
Any ideas if it is possible to improve the hevc_toolbox quality and still retain the speed advantage?
ffmpeg -i test.mp4 -an -c:v libx265 -vtag hvc1 -y test_x265.mp4
ffmpeg -i test.mp4 -an -c:v hevc_videotoolbox -vtag hvc1 -y -b:v 1.5M test_vt.mp4
I am on a MB pro late 2017 version with kaby lake
hevc_videotoolbox is hardware accelerated and because of that it will never be as efficient as x265. If you have the time I would recommend you using x265.
I want to convert a mkv formatted video to mp4, using the ffmpeg application.
and for that I ran below command in terminal:
ffmpeg -y -i c38a4990774b3c23.mkv -c:v libx264 -c:a aac -r 25 -strict -2 -map_metadata -1 -movflags faststart -vf "crop=1920:800:0:4, scale=iw*min(426/iw\,240/ih):ih*min(426/iw\,240/ih), pad=426:240:(426-iw*min(426/iw\,240/ih))/2:(240-ih*min(426/iw\,240/ih))/2, setsar=sar=1" output.mp4
I have compiled ffmpeg with --enable-pthread configuration
when I run this command on my personal PC with a 3.2GHz quad core cpu, it uses 60% of overall cpu process and encode video with 150fps; but when I run this command on a production server with 8 2.4GHz dual core cpu (16 core) it only uses up to 20% of overall cpu process and encode video with 97fps.
I have also tried ramdisk but I got no performance improvement.
My computer (Intel Core 2 Duo T9300, 2.5GHz) can usually play any Full HD file, and Blu-Rays perfectly.
However, when I encode a Full HD file myself, the CPU is struggling and frames are dropped.
Here's my command line:
ffmpeg.exe -r 24 -f concat -i list_of_png_files.txt -i w:\audio.wav -acodec copy -c:v libx264 -preset medium -b:v 10000k -shortest output.avi
I tried adding -maxrate 13000k after "-preset medium". However, x264 doesn't seem to honor this - the framerate still reaches 20MBit at parts.
How can I encode videos in such a way as to reduce CPU usage during decoding?
There is an x264 tuning option for exactly this purpose. I believe -tune fastdecode is what you are looking for. But this will disable some compression features, so the video may not look as good without increasing the bitrate.