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.
Related
I am trying to use libvpx encoder for incoming h264 stream. It works good however it consumes too much cpu (around %50-60). Even when I start second ffmpeg encoder, the frames decreases to 4-5fps. How can I solve cpu consumption problem for libvpx codec on Mac Pro - M1 Pro chip ?
xxx | ffmpeg -f h264 -i pipe:0 -f rtp -codec:v libvpx -filter:v scale=310:420 -preset ultrafast -minrate 500k -maxrate 500k -b:v 500k -crf 40 "rtp://localhost:12333?pkt_size=1200"
CPU Usage around %50-60 for one ffmpeg encoding.
I installed ffmpeg using Macports. ffmepg version is 4.4.1
Thanks
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.
like above question, I want find out what ffmpeg command can help me reduce cpu usage when running 50 IP camera (running same 50 command).
My ffmpeg command:
ffmpeg -f mjpeg -y -use_wallclock_as_timestamps 1 -i 'http://x.x.x.x:8090/test1?.mjpg' -r 3 -reconnect 1 -loglevel 16 -c:v mjpeg -an -qscale 10 -copyts '1.mp4'
50 command like that take my computer (4 core) 200% CPU
I want this computer can run for 150 camera, any advise?
=========================================================
using -c:v copy can make it faster but fize size is terrible
I try slow down frame rate by 3 with -r 3 or -framerate 3 to decrease file size but not succesful (because vcodec copy can't do that).
Have any option to force input frame rate by 3?
(sorry for my bad English)
by setting -c:v mjpeg you are decoding and re-encoding the stream. set -c:v copy to copy the data without re-encoding it.
ffmpeg -re -i 'rtsp://user:password#10.10.10.30/rtsp_tunnel' -pix_fmt yuv420p -c:v libx264 -preset ultrafast -profile baseline -crf 18 -f h264 udp://0.0.0.0:3001
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.
I am using this command to run ffmpeg -
ffmpeg -i - -isync -threads 16 -vcodec libx264 -acodec aac -ar 22050 -r 25 -s 640x360 -strict experimental -b:a 32k -b:v 100k -f flv "rtmp://" -threads 16 -vcodec libx264 -acodec aac -ar 22050 -r 25 -s 640x360 -strict experimental -b:a 32k -b:v 400k -f flv "rtmp://"
I am running ffmpeg processes on my server. Currently ffmpeg don't use all my CPU, I want to use all my CPU usage.
My server has 24 CPU, 16 GB RAM, and 1 TB HDD. Please tell me the command to use all my CPU usage, and to make my ffmpeg smooth.
Thanks
0% idle and 0% wait. That is using 100% of your CPU. Your computer is just not powerful enough to process 20 videos simultaneously. You can try adding the 'ultrafast' option to use less CPU per encode (at the price of lower quality)