|
Hi,
I'm using the pipeline below to record two streams (in sync) one from the webcam and the other, from a framegrabber beside two audio streams into two separate container:
gst-launch-1.0 v4l2src device=/dev/video0 ! videorate ! 'video/x-raw,framerate=24/1' ! videoconvert ! x264enc speed-preset=ultrafast tune=zerolatency ! queue max-size-bytes=0 max-size-buffers=0 max-size-time=0 ! mux2. pulsesrc device="alsa_input.usb-Samson_Technologies_Samson_Go_Mic_Direct-00-Direct.analog-stereo" ! 'audio/x-raw,rate=44100,channels=1' ! queue max-size-bytes=0 max-size-buffers=0 max-size-time=0 ! vorbisenc ! matroskamux name=mux2 ! filesink location=/home/sina/Desktop/Recordings/Screen v4l2src device=/dev/video1 ! 'image/jpeg,width=1920,height=1080,framerate=30/1' ! queue max-size-bytes=0 max-size-buffers=0 max-size-time=0 ! mux. pulsesrc device="alsa_input.usb-046d_Logitech_Webcam_C930e_AAF8A63E-02-C930e.analog-stereo" ! 'audio/x-raw,channels=1,rate=44100' ! queue max-size-bytes=0 max-size-buffers=0 max-size-time=0 ! audioconvert ! queue max-size-bytes=0 max-size-buffers=0 max-size-time=0 ! avenc_aac compliance=experimental ! queue max-size-bytes=0 max-size-buffers=0 max-size-time=0 ! matroskamux name=mux mux. ! filesink location=/home/sina/Desktop/Recordings/Webcam
(Let me also add this: I use ffmpeg afterwards to convert the recorded files into my desired containers:
ffmpeg -i ~/Desktop/Recordings/Screen -vcodec copy -acodec copy ~/Desktop/Recordings/Screen_Con.mp4
ffmpeg -i ~/Desktop/Recordings/Webcam -vcodec copy -acodec copy ~/Desktop/Recordings/Webcam_Con.mkv)
This pipeline works perfectly fine for recording. I have two options on my UI (a simple web interface developed via flask in python) one, to execute this script and following start the recording and the second one to kill the recording process to stop it. here is the stop script, I'm using:
kill -9 $(pidof gst-launch-1.0)
kill -9 $(ps | grep "gst-launch-1.0" | grep -v grep | awk '{ print $1 }')
I'd like to add a pause option as well, to be able to pause the recording process and continue the recording by concatenating the rest to the end of the recorded files (a normal pause option like a typical handy-cam: A+B --> AB at the end) but with this pipeline it seems, I don't have much of a chance or better to say, I don't know how to change it to achieve this functionality.
Can you please help me with that?
What shall I add? how shall I change it in order to get the pause option?
Thanks a lot in advance!
|