简体   繁体   English

gstreamer 在 C++ 中添加 textoverlay

[英]gstreamer add textoverlay in c++

I am trying to add a textoverlay to an mp4 movie with gstreamer-0.10.我正在尝试使用 gstreamer-0.10 将 textoverlay 添加到 mp4 电影中。 Yes I know its old but I only need to do few changes to the mp4.是的,我知道它很旧,但我只需要对 mp4 做一些改动。 I know how to do it with gst-launch-0.10:我知道如何使用 gst-launch-0.10 做到这一点:

gst-launch-0.10 filesrc location=input.mp4 name=src ! gst-launch-0.10 filesrc location=input.mp4 name=src ! decodebin name=demuxer demuxer. decodebin 名称=demuxer demuxer。 ! queue !队列 ! textoverlay text="My Text" ! textoverlay text="我的文字"! x264enc ! x264enc! muxer.混频器。 demuxer.分路器。 ! queue !队列 ! audioconvert !音频转换! voaacenc !哇塞! muxer.混频器。 mp4mux name=muxer ! mp4mux 名称=多路复用器! filesink location=output.mp4文件接收器位置=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:但是现在我需要在 cpp 的以下 bin 中添加 textoverlay - 这是我创建 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?任何人都知道如何将 textoverlay 添加到 bin 中? Cheers Fredrik干杯弗雷德里克

I think you should add queue and textoverlay elements to your pipeline description between ffmpegcolorspace and queue elements:我认为您应该将queuetextoverlay元素添加到ffmpegcolorspacequeue元素之间的管道描述中:

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.我认为您收到了反对票,因为您没有尝试了解 GStreamer 管道描述并要求提供现成的解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM