newBike
newBike

Reputation: 15002

Can not set period/timeout option for ffmepg

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

Upvotes: 4

Views: 21911

Answers (2)

Artur Czyżewski
Artur Czyżewski

Reputation: 833

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

Upvotes: 4

llogan
llogan

Reputation: 133753

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.

Upvotes: 7

Related Questions