我使用以下命令执行此操作:
/usr/local/bin/gst-launch-1.0 filesrc location=/home/ubuntu/DELTA.mpg ! textoverlay text="Hello" ! filesink location=/home/ubuntu/delta2.mpg
但我得到了这个输出:
ubuntu@ip-10-185-10-118:~$ /usr/local/bin/gst-launch-1.0 filesrc location=/home/ubuntu/DELTA.mpg ! textoverlay text="Hello" ! filesink location=file4.mpg
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
WARNING: from element /GstPipeline:pipeline0/GstTextOverlay:textoverlay0: Could
not multiplex stream.
Additional debug info:
gstbasetextoverlay.c(1892): gst_base_text_overlay_video_event(): /GstPipeline:pipeline0/GstTextOverlay:textoverlay0:
received non-TIME newsegment event on video input
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Got EOS from element "pipeline0".
Execution ended after 0:00:00.024475840
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
ubuntu@ip-10-185-10-118:~$
我在这里做错了什么?
答案 0 :(得分:4)
这里的问题是您尝试在未解码的流上叠加文本。 filesrc
元素只读取文件中的数据并输出原始字节。您需要先解码它,然后覆盖文本,然后对其进行编码并写入文件。
这是简单的预览管道:
$ gst-launch filesrc location=test.mpg \
! decodebin2 ! textoverlay text=Hello ! xvimagesink
以下是覆盖文本并将视频编码回文件的管道:
$ gst-launch \
filesrc location=test.mpg \
! decodebin2 name=demuxer \
demuxer. \
! textoverlay text=Hello \
! x264enc ! muxer. \
demuxer. ! audioconvert ! vorbisenc ! muxer. \
matroskamux name=muxer \
! filesink location=output.mkv
我使用不同的输出格式只是为了不依赖于额外的gstreamer插件。您可以将vorbisenc
切换为faac
,将matroskamux
切换为mpegtsmux
以获取output.mpg
文件。