Pradeep
Pradeep

Reputation: 1

Extraction of overlay text from h264 video file using gstreamer

How to overlay a text onto the h264 stream and store it using GStreamer so that overlay text can be extracted later. I need to extract the overlay text from the video.

I am using the following command to overlay text onto the stream and store it.

gst-launch-1.0 -e imxv4l2videosrc ! textoverlay text="Sample Video" valignment=position halignment=position xpos=1 ypos=1 font-desc="Sans, 20" ! timeoverlay ! vpuenc_h264 ! matroskamux ! filesink location=video.mp4

Is it possible to extract the text overlay from the video generated using above command? If not, how to overlay a text, so that it can be extracted later?

Upvotes: 0

Views: 770

Answers (1)

mpr
mpr

Reputation: 3378

You won't be able to readily extract or remove the timeoverlay data because that element is rendering directly into the video buffers. It becomes fully encoded into the h264 data as if it were part of the original video. Not like subtitles.

There are ways you could still do this, but they'd generally involve your saving the timestamps to a separate file and then merging them into the video playback later when you need 'em. Unless perhaps mp4 has some frame level metadata features that I'm unaware of.

Upvotes: 0

Related Questions