RidgeRun / gst-interpipe

GStreamer plug-in for interpipeline communication
Other
140 stars 63 forks source link

Multiple Interpipes #110

Closed nwscfox closed 2 years ago

nwscfox commented 2 years ago

I'm trying to connect a camera, through an interpipe to an mp4mux and then an audio source through a second interpipe pair to the same mp4mux and I keep getting a "critical" error. The pipeline I'm using is: $ gst-launch-1.0 -e v4l2src device=/dev/video2 ! video/x-h264,width=1920,height=1080,fps=30 ! interpipesink name=v \ interpipesrc name=iv listen-to=v ! queue ! h264parse ! mp4mux name=muxer ! filesink location=output.mp4 \ alsasrc device="hw:CARD=wm8904audio" ! queue ! audioconvert ! lamemp3enc target=1 bitrate=64 cbr=true ! interpipesink name=a \ interpipesrc name=ia listen-to=a ! queue ! muxer.audio_0 The error I get is: (gst-launch-1.0:75744): GStreamer-CRITICAL **: 23:16:58.556: gst_segment_to_running_time: assertion 'segment->format == format' failed

(gst-launch-1.0:75744): GStreamer-CRITICAL **: 23:16:58.556: gst_segment_to_running_time: assertion 'segment->format == format' failed

I've tried the pieces by themselves and they seem to work but the two interpipes at the same time generate the error. I've tried setting GST_DEBUG but nothing seems obvious. I was able to make it work by saving the audio using a filesink to a mp3 file just to convince myself everything was hooked up properly. (I really need the audio in the MP4 file.)

michaelgruner commented 2 years ago

Hi, can you try setting format=time in the interpipesrc elements?

nwscfox commented 2 years ago

That worked!

But an odd thing, I placed the format=time on both the video and the audio interpipe's and the first time I ran the script it worked. Subsequent runs failed because of a "Buffer has no PTS". I experimented (and googled) a bit and decided the "format=time" is only required on the audio path. So the final pipeline I used was:

gst-launch-1.0 -e v4l2src device=/dev/video2 ! video/x-h264,width=1920,height=1080,fps=30 ! interpipesink name=v \ interpipesrc name=iv listen-to=v ! queue ! h264parse ! mp4mux name=muxer ! filesink location=output.mp4 \ alsasrc device="hw:CARD=wm8904audio" ! queue ! audioconvert ! lamemp3enc target=1 bitrate=64 cbr=true ! interpipesink name=a \ interpipesrc name=ia format=time listen-to=a ! queue ! muxer.audio_0

Thank you for the quick and effective solution!