gstreamer add textoverlay in c++

I am trying to add a textoverlay to an mp4 movie with gstreamer-0.10. Yes I know its old but I only need to do few changes to the mp4. I know how to do it with gst-launch-0.10:

gst-launch-0.10 filesrc location=input.mp4 name=src ! decodebin name=demuxer demuxer. ! queue ! textoverlay text="My Text" ! x264enc ! muxer. demuxer. ! queue ! audioconvert ! voaacenc ! muxer. mp4mux name=muxer ! filesink location=output.mp4

This creates a text overlay movie for me. But now I need to add the textoverlay in the following bin in cpp - this is my working pipeline creating an mp4:

QGst::BinPtr m_encBin = QGst::Bin::fromDescription( 
   "filesrc location=""+path+"videoname.raw.mkv" ! queue ! matroskademux name="demux" " 
   "demux.video_00 ! queue ! ffmpegcolorspace ! queue ! x264enc ! queue ! mux.video_00 " 
   "demux.audio_00 ! queue ! audioconvert ! queue ! faac ! queue ! mux.audio_00 " 
   "mp4mux name="mux" ! queue ! filesink name="filesink" sync=false ",
   QGst::Bin::NoGhost);

Anyone knows how I can add the textoverlay into the bin? Cheers Fredrik


I think you should add queue and textoverlay elements to your pipeline description between ffmpegcolorspace and queue elements:

QGst::BinPtr m_encBin = QGst::Bin::fromDescription( 
   "filesrc location=""+path+"videoname.raw.mkv" ! queue ! matroskademux name="demux" " 
   "demux.video_00 ! queue ! ffmpegcolorspace ! queue ! textoverlay text="My Text" ! queue ! x264enc ! queue ! mux.video_00 " 
   "demux.audio_00 ! queue ! audioconvert ! queue ! faac ! queue ! mux.audio_00 " 
   "mp4mux name="mux" ! queue ! filesink name="filesink" sync=false ",
   QGst::Bin::NoGhost);

I think you received downvote because you didn't try to understand GStreamer pipelines description and asked for ready-to-use solution.

链接地址: http://www.djcxy.com/p/7644.html

上一篇: 在gstreamer中采样视频文件编码

下一篇: gstreamer在c ++中添加textoverlay