How can I call PauseStreams on my batch Capture?

Ask software engineering and SDK questions for developers working on Mac OS X, Windows or Linux.
  • Author
  • Message
Offline

malatwork

  • Posts: 7
  • Joined: Fri May 31, 2019 10:23 pm
  • Real Name: Mike Lopez

How can I call PauseStreams on my batch Capture?

PostFri May 31, 2019 10:31 pm

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 \
...
Offline

scdroid13

  • Posts: 2
  • Joined: Fri Jun 07, 2019 6:56 am
  • Real Name: Sushant Chaudhari

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

PostFri Jun 07, 2019 6:59 am

Hello can you share the clock of code to understand more?
Offline

malatwork

  • Posts: 7
  • Joined: Fri May 31, 2019 10:23 pm
  • Real Name: Mike Lopez

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

PostFri Jun 07, 2019 10:37 pm

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


Offline

Cameron Nichols

Blackmagic Design

  • Posts: 442
  • Joined: Mon Sep 04, 2017 4:05 am

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

PostFri Jun 14, 2019 5:12 am

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
Offline

malatwork

  • Posts: 7
  • Joined: Fri May 31, 2019 10:23 pm
  • Real Name: Mike Lopez

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

PostWed Jun 19, 2019 7:08 pm

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.

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 19 guests