I'm new to gstreamer and I'm trying to make a video editing tool that can be previewed with webrtc stream.
I'm using gstreamer-rs
, and I can create a pipeline with emits rtp stream by using normal Gst::Pipeline, but with GESPipeline
I can't do the same thing.
I tried following code but get Message { ptr: 0x12682f600, type: "error", seqnum: 970, src: Some("internal-sinks"), structure: Some(GstMessageError, gerror=(GError)NULL, debug=(string)"../gst/playback/gstplaysink.c\(2032\):\ gen_video_chain\ \(\):\ /GESPipeline:gespipeline0/GstPlaySink:internal-sinks:\012Failed\ to\ configure\ the\ video\ sink.";) }
error.
#[tokio::main]
async fn main() {
gstreamer_editing_services::init().unwrap();
let timeline = Timeline::new_audio_video();
let layer = timeline.append_layer();
let uri = filename_to_uri("/Users/itome/Downloads/sea-cafinet.mp4", None).unwrap();
let clip = UriClip::new(&uri).unwrap();
layer.add_clip(&clip).unwrap();
let pipeline = Pipeline::new();
pipeline.set_timeline(&timeline).unwrap();
let enc = ElementFactory::make("vp8enc", None).unwrap();
let pay = ElementFactory::make("rtpvp8pay", None).unwrap();
let appsink = ElementFactory::make("appsink", Some(&"app")).unwrap();
let bin = Bin::new(None);
bin.add_many(&[&enc, &pay, &appsink]).unwrap();
enc.link(&pay).unwrap();
pay.link(&appsink).unwrap();
pipeline.preview_set_video_sink(&bin);
// Start playing
pipeline
.set_state(State::Playing)
.expect("Unable to set the pipeline to the `Playing` state");
// Wait until error or EOS
let bus = pipeline.bus().unwrap();
for msg in bus.iter_timed(ClockTime::NONE) {
println!("{:?}", msg);
match msg.view() {
MessageView::Eos(..) => {
break;
}
MessageView::Error(err) => {
println!("Error from: {} ({:?})", err.error(), err.debug());
break;
}
_ => (),
}
}
// Shutdown pipeline
pipeline
.set_state(State::Null)
.expect("Unable to set the pipeline to the `Null` state");
}
Is there any way to make GESPipeline
work with rtp elements?