문제

I am using the following command to do it:

/usr/local/bin/gst-launch-1.0 filesrc location=/home/ubuntu/DELTA.mpg ! textoverlay text="Hello" ! filesink location=/home/ubuntu/delta2.mpg

But I am getting this output:

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:~$

What am I doing wrong here ?

도움이 되었습니까?

해결책

The problem here is that you are trying to overlay text on undecoded stream. filesrc element just reads data from the file and outputs raw bytes. You need to decode it first, then overlay the text, then encode it back and write to file.

Here is simple preview pipeline:

$ gst-launch  filesrc location=test.mpg \
    ! decodebin2 ! textoverlay text=Hello ! xvimagesink

And here is the pipeline that overlays text and encodes video back to the file:

$ 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

I used different output format just to not depend on additional gstreamer plugins. You can switch vorbisenc to faac and matroskamux to mpegtsmux to get output.mpg file.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top