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.