<div dir="ltr"><div>Summary: I think no plugin exists that can give me the written webm segment byte-offset at disk. Trying to figure out where to insert an event in the webmmux plugin.</div><div><br></div>Going through the webmmux plugin code, it looks like the master segment is written here: <a href="https://github.com/GStreamer/gst-plugins-good/blob/20bbeb5e37666c53c254c7b08470ad8a00d97630/gst/matroska/matroska-mux.c#L2651">https://github.com/GStreamer/gst-plugins-good/blob/20bbeb5e37666c53c254c7b08470ad8a00d97630/gst/matroska/matroska-mux.c#L2651</a>.<div>I *think* a 'normal' segment is written here: <a href="https://github.com/GStreamer/gst-plugins-good/blob/20bbeb5e37666c53c254c7b08470ad8a00d97630/gst/matroska/matroska-mux.c#L3187">https://github.com/GStreamer/gst-plugins-good/blob/20bbeb5e37666c53c254c7b08470ad8a00d97630/gst/matroska/matroska-mux.c#L3187</a>, but I am not 100% sure. Looks like it finishes it's writing here: <a href="https://github.com/GStreamer/gst-plugins-good/blob/20bbeb5e37666c53c254c7b08470ad8a00d97630/gst/matroska/matroska-mux.c#L3304">https://github.com/GStreamer/gst-plugins-good/blob/20bbeb5e37666c53c254c7b08470ad8a00d97630/gst/matroska/matroska-mux.c#L3304</a>.</div><div><br></div><div>I guess I need to keep track of the segment offset at the start and its final size to get a similar output (from <a href="https://github.com/acolwell/mse-tools">https://github.com/acolwell/mse-tools</a>, <span style="color:rgb(242,242,242);font-family:Monaco;font-size:10px;background-color:rgba(0,0,0,0.85)">mse_json_manifest</span>) to this:</div><div><p style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Monaco;color:rgb(242,242,242);background-color:rgba(0,0,0,0.85)"><span style="font-variant-ligatures:no-common-ligatures">  "init": { "offset": 0, "size": 531},</span></p>
<p style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Monaco;color:rgb(242,242,242);background-color:rgba(0,0,0,0.85)"><span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space">  </span>"media": [</span></p>
<p style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Monaco;color:rgb(242,242,242);background-color:rgba(0,0,0,0.85)"><span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space">    </span>{ "offset": 531, "size": 28194, "timecode": 0.000000 },</span></p>
<p style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Monaco;color:rgb(242,242,242);background-color:rgba(0,0,0,0.85)"><span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space">    </span>{ "offset": 28725, "size": 28007, "timecode": 0.041000 },</span></p>
<p style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Monaco;color:rgb(242,242,242);background-color:rgba(0,0,0,0.85)"><span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space">    </span>{ "offset": 56732, "size": 27994, "timecode": 0.083000 },</span></p>
<p style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Monaco;color:rgb(242,242,242);background-color:rgba(0,0,0,0.85)"><span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space">    </span>{ "offset": 84726, "size": 27999, "timecode": 0.125000 },</span></p>
<p style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Monaco;color:rgb(242,242,242);background-color:rgba(0,0,0,0.85)"><span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space">    </span>{ "offset": 112725, "size": 28006, "timecode": 0.166000 },</span></p>
<p style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Monaco;color:rgb(242,242,242);background-color:rgba(0,0,0,0.85)"><span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space">    </span>{ "offset": 140731, "size": 28012, "timecode": 0.208000 },</span></p><p style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:Monaco;color:rgb(242,242,242);background-color:rgba(0,0,0,0.85)"><span style="font-variant-ligatures:no-common-ligatures">  ]</span></p></div><div><br></div><div>In the output above, init shows the initialization segment, and the media contains the array of segments that follow.</div><div><br></div><div>In case anyone would be able to help with adding this functionality, or providing knowledge about an existing element/property that is helpful here, please let me know :)</div><div>Thank you very much in advance!</div><div><br></div><div>Sincerely,</div><div>Floris Weers</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Op di 10 mei 2022 om 19:50 schreef F Weers <<a href="mailto:dedomme123@gmail.com">dedomme123@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi all,<div><br></div><div>summary: I have a pipeline that writes any video (with audio) to webm format (in which every frame is a keyframe), I want to know the byteoffsets of the (key-)frames of the written file. </div><div><br></div><div>First of all, thanks for the awesome Rust support of GStreamer. I'm quite new to Rust, but it feels very natural to convert a console-command to the Rust equivalent!</div><div>I have the following (simplified) pipeline:</div><div><pre style="background-color:rgb(43,43,43);color:rgb(169,183,198);font-family:"JetBrains Mono",monospace"><span style="color:rgb(98,151,85);font-style:italic">gst-launch-1.0 webmmux name=mux ! filesink location="output.webm" filesrc location="input.mp4" ! decodebin name=demux \<br></span><span style="color:rgb(98,151,85);font-style:italic">demux. ! videoconvert ! videoscale ! videorate ! vp9enc !  mux.video_0 \<br></span><span style="color:rgb(98,151,85);font-style:italic">demux. ! audioconvert ! audioresample ! opusenc ! mux.audio_0</span></pre></div><div><br></div><div>It converts an mp4 file to a webm file (I started with this ffmpeg command: 'ffmpeg -i input.mp4 -c:v libvpx-vp9 -crf 30 -g 1 -b:v 0 -b:a 128k -c:a libopus output.webm'). This works great. In my code, I also set the <span style="color:rgb(106,135,89);font-family:"JetBrains Mono",monospace;background-color:rgb(43,43,43)">keyframe-max-dist</span> to 1, which means that every frame is a keyframe (the '-g 1' argument in the ffmpeg command). Now, I'd like to get the byte offsets of the key-frames, so I can directly load the segments from disk. While I can get those offsets using <a href="https://github.com/acolwell/mse-tools" target="_blank">https://github.com/acolwell/mse-tools</a> , I'd like to get them directly while converting an input video to its webm version with only keyframes.</div><div><br></div><div>Thank you in advance! Let me know if something is unclear.</div><div><br></div><div>Sincerely,</div><div>Floris Weers</div></div>
</blockquote></div>