D
D
duoman2015-09-15 20:06:38
Nginx
duoman, 2015-09-15 20:06:38

Stream resizing with ffmpeg?

Good afternoon! I'm trying to resize a stream from 1280x720 to 720x480
. So I take three rtsp streams from three cameras using ffmpeg and transfer them to the dash and hls folder in two resolutions: 1280x720 and 720x480. total of that 12 streams. And it turns out that the whole thing starts a lot of ffmpeg processes and loads all the i7-3770K CPU @ 3.50GH cores at 100%.
I am attaching an application (nginx) from one stream

application src {
            live on;
            exec_options on;
            exec_static ffmpeg -threads 0 -rtsp_transport tcp -re
-i "rtsp://admin:[email protected]:554/cam/realmonitor?channel=1&subtype=0"
-c copy -f flv -r 25 -bufsize 2M -s 1280x720 -an "rtmp://localhost:1935/hls/camera1 2>>/var/log/nginx/ffmpeg.log"
-c libx264 -f flv -r 25 -bufsize 2M -vf scale=720:480  -an "rtmp://localhost:1935/hls/720pcamera1 2>>/var/log/nginx/ffmpeg.log"
-c copy -f flv -r 25 -bufsize 2M -s 1280x720 -an "rtmp://localhost:1935/dash/camera1 2>>/var/log/nginx/ffmpeg.log"
-c libx264 -f flv -r 25 -bufsize 2M -vf scale=720:480 -an "rtmp://localhost:1935/dash/720pcamera1 2>>/var/log/nginx/ffmpeg.log";
        }

If I do not use video stream resizing, then the download takes no more than 5 - 10% of one core.
Perhaps I made a mistake or do I really need so many resources to change the resolution?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
monah_tuk, 2015-09-21
@monah_tuk

Moskus correctly hinted at the conversion.
There are few options for fighting: use hardware encoding (for example, Intel QSV, which is available with FFmpeg 2.7.1 or nVidia NVENC, which appeared earlier), which will slightly reduce the load; put up with it or use a farm for encoding (encode the stream on other machines and do a restream).
It is optimal to make a mix of hardware coding and load distribution across the farm.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question