Page 1 of 1

How can I call PauseStreams on my batch Capture?

PostPosted: Fri May 31, 2019 10:31 pm
by malatwork
I start Capture in Linux in a shell script. What kind of tools exist so I can call that API method PauseStreams() to pause and resume the video? Right now another script just stops the thread and resumes but after that our video and audio drift apart. Here's a chunk of my script:

/home/user/Scripts/Capture -d 0 -m 14 -p 0 -v /home/user/Videos/pipeVideo -a /home/user/Videos/pipeAudio &

ffmpeg \
-f s16le \
...

Re: How can I call PauseStreams on my batch Capture?

PostPosted: Fri Jun 07, 2019 6:59 am
by scdroid13
Hello can you share the clock of code to understand more?

Re: How can I call PauseStreams on my batch Capture?

PostPosted: Fri Jun 07, 2019 10:37 pm
by malatwork
Code: Select all
## nothing actually starts recording until we have all 3 running.
## Start Recording the stream capture first to the named pipes
/home/user/Scripts/Capture -d 0 -m 14 -p 0 -v /home/user/Videos/pipeVideo -a /home/user/Videos/pipeAudio &


## Now we will tell the wav to start. Nothing actually starts yet.
logSuccess ${RecordId} $(hostname) $0 "Starting the ffmpeg for wav" &

ffmpeg \
   -f s16le \
   -ar 48000 \
   -ac 2 \
   -sample_fmt sb16 \
   -i /home/user/Videos/pipeAudio \
   -acodec pcm_s16le \
   -ac 1 \
   -ar 48000 \
   -b:a 192k  \
   /home/user/Videos/${RecordId}.wav \
   2>&1 | tee -a ${wavLogPath} &

## Now we will tell the avi to start. this will start everything moving.
logSuccess ${RecordId} $(hostname) $0 "Starting the ffmpeg for avi" &

ffmpeg \
   -vcodec rawvideo \
   -f rawvideo \
   -pix_fmt uyvy422 \
   -s 1280x720 \
   -r 59.94 \
   -y \
   -i /home/user/Videos/pipeVideo  \
   -vcodec libx264 \
   -preset ultrafast \
   -tune fastdecode \
   -crf 12 \
   -aspect 16:9  \
   /home/user/Videos/${RecordId}.avi \
   2>&1 | tee -a ${aviLogPath} &

## We will continue on a seperate path here

## We want to make sure they have started
while [ ! -f /home/user/Videos/${EventId}.wav  ]
do
  sleep 0.25
done

## from another script which pauses
## to pause the card we will be pausing the actual capturing of the card.
## Since we are using a named pipe we are just pausing the pipe flow.
## we will need to put some error control in to make sure we are ok
ps axw | grep -i [/]Capture | awk -v PROC="$1" '{print $1}' | xargs kill -stop



Re: How can I call PauseStreams on my batch Capture?

PostPosted: Fri Jun 14, 2019 5:12 am
by Cameron Nichols
Hi Mike,

Your proposed setup won't work, you can't just pause the stream and handover to another application without first disabling the input. You need to ensure that IDeckLinkInput::DisableVideoInput/DisableAudioInput are called by Capture prior to running FFmpeg.

Regards
Cameron

Re: How can I call PauseStreams on my batch Capture?

PostPosted: Wed Jun 19, 2019 7:08 pm
by malatwork
How do I call the API commands on Capture from the shell?

I cant really pause the capture before the ffmpeg, Capture is running and I pause it (stop the thread) when I want recording to pause. ffmpeg keeps going till the end. It works but after the pause my audio drifts.