Creating avi recording with two appsrc elements

I am adding recording support to an emulator I am writing and am using two appsrc elements to introduce my generated audio and video into the gstreamer pipeline.

I am using the gstreamer-rs crate in a rust application.

Code can be found at https://github.com/uglyoldbob/old_systems/blob/stream/nes/rust/src/recording.rs

My current behavior is that I can get video in the recording just fine if I only do video. When I try to do video and audio at the same time, I only get audio.

vlc reports that the video file indeed contains a video and an audio element, but apparently no video data.

Setting blocking on the video appsrc just ends up hanging the application.

I figured out my problem. I needed to add timestamps and configure the appsrc elements as live.

Configuring them live shouldn’t be necessary, unless your input actually is live. Timestamps are required and setting the appsrc’s format to gst::Format::Time is necessary however.

If your input is actually live, you can use do-timestamp=true on the appsrc and then it creates timestamps itself based on when you provide the buffers to it from your application. But if you have better timestamp information in your application then you better make use of those directly.