First, Process brief:
1, the first involves the plug-in type Textoverlay, the plug-in will detect whether the streaming media contains subtitles, if there is a subtitle will be called Pango and Cairo Library, the subtitle string into a picture, Compositon for processing unit and video buffer along with the pass down.
2. On the Vaapisink side, the Vaassociate () will be called and the caption picture will be fused together with the video frame to display.
Second, performance improvement:
Modified on the basis of the principle design, the previous design creates a subpicture in the video memory when each frame is displayed, which causes a large amount of data to be copied from the system memory to the video memory. As long as subtitles appear, the CPU occupancy rate will increase a lot, so it will consume a lot of resources.
Improvement: In every video surface, as long as you find subtitles are not the same will be to create subpicture, or directly return, so the same title created by the number of video surface is equal to the number, greatly improved before each frame will be to create efficiency.
Two caption Stream commands are displayed:
gst-launch-0.10 filesrc Location=/root/video_test/darkshadows_2ch_6ch_figs_17tracks.mp4! \
Qtdemux name=dmx \
Multiqueue name=mq \
Textoverlay name=tone \
Textoverlay Name=ttwo valignment=2 \
Dmx.video_00! Mq.sink0 MQ.SRC0! Vaapidecode! Tone.video_sink \
Dmx.audio_00! MQ.SINK1 MQ.SRC1! Queue! Faad! Alsasink \
Dmx.subtitle_00! MQ.SINK2 MQ.SRC2! Tone.text_sink \
Dmx.subtitle_01! Mq.sink3 MQ.SRC3! Ttwo.text_sink \
Tone.src! Ttwo.video_sink TTWO.SRC! Vaapisink
Gstreamer Video Subtitles