Hello.
I want to save what camera "sees" in a file while also displaying it on the screen. I have figured out that I can do that with this command gst-launch-1.0 -e v4l2src device=/dev/video0 ! videoconvert ! queue ! tee name=t t. ! queue ! matroskamux ! queue ! filesink location=/tmp/test.mkv t. ! queue ! autovideosink sync=false But since I'm working on a C program that uses GStreamer and GTK I need to translate this command to C and I don't know how to properly do it. I also want my program to allow users to pause the recording but not the video output but I successfully figured that out. In the end my pipeline looks like this /-> queue -> autovideosink v4l2src -> videoconvert -> queue -> tee \-> queue -> matroskamux -> queue -> filesink || fakesink The reason for "filesink || fakesink" is because these two are swapped when the recording state changes: when we're recording filesink is present and when a user pauses the recording filesink is replaced with fakesink (and when a user unpauses the recording fakesink is replaced by filesink, etc.). I wrote a small program (available as an attachment) that can replicate all relevant problems that I have encountered in my project. Use "Pause" / "Unpause" button to pause / unpause the recording and "Stop" button to stop the recording and quit the application (normally quitting the application can be achieved by also closing the control window (the one with the buttons) but not by closing preview window (I didn't bother changing the preview window to custom GTK window so this is the default window provided by GStreamer)). I hope it's OK that this example program uses a little bit of GTK, it's only there for the control window and you don't have to know anything about GTK to help me with my problem. I used video player MPV to test the resulting MKV files. These are the errors that I have found when running my program (all these errors also exist in attached program if you find more please tell me): 1. If I click on "Pause" then on "Unpause" the resulting file is too corrupted to be recognized by MPV as an MKV file. 2. If I do not click "Pause" button or click it only once before stopping the program MPV displays errors like "[mkv] Expected element 0x1043a770 not found" when opening the file (usually three these). If I use gst-launch-1.0 command mentioned at the beginning of this letter opening the resulting MKV file does not produce such errors. 3. When the resulting file produced as in error 2 and is played using MPV, MPV seems unable to determine the duration of the file so it constantly changes what it thinks the duration is. Again, if I use command mentioned at the beginning of this letter this problem doesn't occur. I think that's it. _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel main.c (16K) Download Attachment |
Free forum by Nabble | Edit this page |