<div dir="ltr">Hi, I have a simple pipeline that mixes subtitles over a pre-made video:<div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">  5     gst-launch-1.0 \ <br>  6         filesrc location=sample_videos/my-video.mp4 ! decodebin ! mixer.sink_0 \ <br>  7         filesrc location=subtitles.srt ! subparse ! textrender !  mixer.sink_1 \ <br>  8         videomixer name=mixer sink_0::zorder=2 sink_1::zorder=3 sink_1::ypos=-25 sink_1::alpha=1 \ <br>  9             ! video/x-raw, height=540 \ </blockquote><div><br></div><div><div class="gmail_signature"><div dir="ltr"><span style="border-collapse:collapse"><font face="arial, helvetica, sans-serif"><div style="background-color:transparent;border-collapse:separate"><span style="color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;text-decoration:initial;vertical-align:baseline;white-space:pre-wrap"><font size="2">My client wants the subtitles to fade in and fade out.  </font></span></div><div style="background-color:transparent;border-collapse:separate"><span style="color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;text-decoration:initial;vertical-align:baseline;white-space:pre-wrap"><font size="2"><br></font></span></div><div style="background-color:transparent;border-collapse:separate"><span style="color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;text-decoration:initial;vertical-align:baseline;white-space:pre-wrap"><font size="2">I have spent the past few days reading Gstreamer docs (I'm a newbie to Gstreamer and to video processing) and am still not sure of how best to implement this.  </font></span></div><div style="background-color:transparent;border-collapse:separate"><span style="color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;text-decoration:initial;vertical-align:baseline;white-space:pre-wrap"><font size="2"><br></font></span></div><div style="background-color:transparent;border-collapse:separate"><span style="color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-variant-ligatures:normal;font-variant-caps:normal;text-decoration:initial;vertical-align:baseline;white-space:pre-wrap"><font size="2">The videomixer element has a sink pad with an alpha parameter that I believe can be modified at runtime.  Therefore, I could implement a <i>control source</i> (see section 16.2 of gstreamer-manual.pdf) that can independently parse the SRT file.  Then I can connect that to the appropriate mixer sink pad to "slide" its alpha parameter when a subtitle first appears to achieve a fade-in effect.  Ditto for the fade-out effect when the duration of the subtitle is about to end.  (I can easily parameterize the length of the fade effects.)</font></span></div><div style="background-color:transparent;border-collapse:separate"><span style="color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-variant-ligatures:normal;font-variant-caps:normal;text-decoration:initial;vertical-align:baseline;white-space:pre-wrap"><font size="2"><br></font></span></div><div style="background-color:transparent;border-collapse:separate"><span style="color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-variant-ligatures:normal;font-variant-caps:normal;text-decoration:initial;vertical-align:baseline;white-space:pre-wrap"><font size="2">But I am wondering if there might be a better approach.  For example, the subparse element already parses the SRT file so I could clone it and write a new plugin that also creates the above-mentioned control-source, which I can then access from my app and connect to the mixer sink pad.</font></span></div><div style="background-color:transparent;border-collapse:separate"><span style="color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-variant-ligatures:normal;font-variant-caps:normal;text-decoration:initial;vertical-align:baseline;white-space:pre-wrap"><font size="2"><br></font></span></div><div style="background-color:transparent;border-collapse:separate"><span style="color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-variant-ligatures:normal;font-variant-caps:normal;text-decoration:initial;vertical-align:baseline;white-space:pre-wrap"><font size="2">Or, I could clone the textrender element to add a fade-in fade-out effect when subtitles change.  This seems like it might be the cleanest and most sensible way to achieve my goal, but I don't have enough experience to know for sure.</font></span></div><div style="background-color:transparent;border-collapse:separate"><span style="color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-variant-ligatures:normal;font-variant-caps:normal;text-decoration:initial;vertical-align:baseline;white-space:pre-wrap"><font size="2"><br></font></span></div><div style="background-color:transparent;border-collapse:separate"><span style="background-color:transparent;vertical-align:baseline"><font size="2"><font color="#000000"><span style="white-space:pre-wrap">Does anyone have an opinion on the pros and cons of the different approaches?</span></font></font></span></div><div style="background-color:transparent;border-collapse:separate"><span style="background-color:transparent;vertical-align:baseline"><font size="2"><font color="#000000"><span style="white-space:pre-wrap"><br></span></font></font></span></div><div style="background-color:transparent;border-collapse:separate"><span style="background-color:transparent;vertical-align:baseline"><font size="2"><font color="#000000"><span style="white-space:pre-wrap">Thanks,</span></font></font></span></div><div style="background-color:transparent;border-collapse:separate"><span style="color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;text-decoration:initial;vertical-align:baseline;white-space:pre-wrap"><font size="2"><br></font></span></div><div style="background-color:transparent;border-collapse:separate"><span style="color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;text-decoration:initial;vertical-align:baseline;white-space:pre-wrap"><font size="2">-Larry Siden, </font></span><span style="font-size:small;background-color:transparent;color:rgb(0,0,0);white-space:pre-wrap"><a href="http://plus.google.com/+LarrySiden" target="_blank">http://plus.google.com/+LarrySiden</a></span></div></font></span></div></div></div>
</div></div>