Sample Header Ad - 728x90

How to limit FFmpeg bitrate while recording an RTSP stream with codec copy?

0 votes
1 answer
557 views
I am trying to record a short video from an RTSP stream using FFmpeg.  And I am facing the following problem: the video size is too large.  Using the command ffmpeg -i file.mp4, I've come to the conclusion that this is due to the bitrate that I am receiving from the camera RTSP stream. To reduce the video size, I want to limit the bitrate.  I don't mind losing quality by doing this.  So I am using the following ffmpeg command: ffmpeg -i STREAM_URL -use_wallclock_as_timestamps 1 -vcodec copy -an //Suppress audio stream -b:v 1000k //Establish 1000 kbps for bitrate -minrate 500k -maxrate 1500k -bufsize 1000k -f segment -segment_time 300 -segment_format mkv output%03d.mkv -max_muxing_queue_size 2048 //To fix bug: Too many packets buffered for output stream I am using the previous command to record the stream.  With -vcodec copy, it doesn't limit the bitrate. The RTSP stream is using H.264 video encoding. Is it possible to limit the bitrate without having to re-encode the video?
Asked by bram (1 rep)
Mar 4, 2024, 11:37 AM
Last activity: Nov 4, 2024, 06:31 PM