Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can not set period/timeout option for ffmepg

Tags:

ffmpeg

I tried to capture streaming via rtsp and limit the clip duration under 3 sec

But the option doesn't work. The ffmpeg won't be terminated anymore.

Is there any workaround to fix the problem.

Because I have to run hundreds of similar commands in a batch with Python script.

ffmpeg -loglevel verbose   -i rtsp://172.19.1.42/live.sdp -acodec copy -vcodec copy  c0_s1_h264_640x480_30_vbr_500_99_40000000.mp4 -timeout 3 -y

$ ffmpeg -h ffmpeg version 1.2.4 Copyright (c) 2000-2013 the FFmpeg developers built on Nov 22 2013 11:59:59 with Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)

The detailed log at https://gist.github.com/poc7667/8234701

like image 933
newBike Avatar asked Dec 19 '22 19:12

newBike


2 Answers

From your console output:

Trailing options were found on the commandline.

Option placement matters:

ffmpeg [global options] [input options] -i input [output options] output

How is ffmpeg supposed to interpret your trailing options? Your command should look like:

ffmpeg -y -loglevel verbose -timeout 3 -i rtsp://172.19.1.42/live.sdp -acodec copy -vcodec copy  c0_s1_h264_640x480_30_vbr_500_99_40000000.mp4

See the FFmpeg RTSP Protocol Documentation for more information, but you should refer to your local copy of your docs since the online docs are synced with current code from Git master and your ffmpeg version is old.

like image 55
llogan Avatar answered Dec 28 '22 06:12

llogan


You need to use stimeout parameter:

ffmpeg -loglevel verbose -i rtsp://172.19.1.42/live.sdp -acodec copy -vcodec copy c0_s1_h264_640x480_30_vbr_500_99_40000000.mp4 -stimeout 3000 -y

Note that you should use microseconds with stimeout param

like image 28
Artur Czyżewski Avatar answered Dec 28 '22 07:12

Artur Czyżewski