video issue -- thinking out loud and could do with help please

OK. I'm well out of my depth, but this problem has been around too long unfixed and it needs fixing. If I 'think out loud' here, maybe others could chip in? Sorry this is a bit lengthy.

The problem: a video on an Impress slide starts and finishes with an inappropriate frame displayed. I've made a series of test videos, the frames simply containing the frame number from 0....N-1, and in a selection of formats (.mp4, .flv and ".avi") using avconv. I then embed that video into a slide using Insert|Audio or Video.

A placeholder frame from the video is displayed during editing. This is a frame from within the video, but it isn't always the same one. It depends on the length and format and frame-rate of the video. So, for example, using 15fps, a 50-frame flv video shows the frame #24 (the 25th frame, starting at #0), A 35-frame video shows #12, and a 25-framer shows #0. a long mp4 shows #30, a 10-frame mp4 shows #5, with a selection between. An avi just shows a question mark, presumably because something can't seek into the video (supposition!).

For comparison, a 1500-frame clip at 15fps starts on frame #30; at 25fps, it starts on frame #75.

Much the same also applies to LO6's property page video preview - with the addition that when the seek slider is tweaked, the placeholder is also shown while the slider is being moved (it usually settles down to show a reasonable frame, not always.)

Scott,

You might have better luck posting your question to the developer
mailing list, or directly on the dev IRC channel.

Alex

​Some thoughts about this.
Inserting video is finicky. At least your problem isn't that it randomly
stop working sometimes or that some formats are unsupported. These two
issues alone pushes a lot of people to simply have their video file at hand
during presentation, and switch to that instead of embeding it, which in
turns means that less people embed video, so issues are harder to diagnose,
etc.

About the thumbnail: on most of my (not so thorough) tests, LibreOffice
always showed the first frame as the preview, so it was not an issue. My
version is 5.3.1.2, but I'm afraid the preview picture is more a matter of
OS and media package than LibreOffice itself.
An "immediate" solution would be to surround your slides with video, with
slides with static images and no transition.

Here's what I did:
- Create a presentation with three slides: dummy1, video, dummy2
- Have long transitions on them. This shows that going from the video slide
to the dummy2 slide, the video preview image (in my case the first image of
the video) shows during the transition, which is not good
- Add a slide after the video with no transition. Place a capture of the
video's last frame at the exact same place the video should be (using
placement properties it's quite easy, even if tedious)

This way, when I move to the next slide after the video, the transition
looks smooth. I suppose the same thing could be done before the slide to
show the correct first frame in every case. One last issue I found there is
that the video flicker slightly when it starts playing; again, this is
probably OS/Library dependant.

This is obviously not an ideal solution. Ideally, you could specify on
which frame/timestamp the video should initially be, or simply just always
display the first frame one entering, and the current frame on exiting the
slide. Maybe there's even a suggestion about this, but obviously it' not
high priority since it's been around for so long.

Maybe I'll go there, as I seem to have found a workable answer. Not that I understand fully why it works; nor is it a complete and proper solution.

It's all down to "magic numbers". Rule two of code writing - never, ever, embed literal numbers in the depths of your code.

Well, there's a file mediawindow.cxx that has a grabFrame method that (I assume) is what's called by whatever displays the static placeholder.

This has embedded within it a so-called default frame - which is at 3.0 seconds or half the media length. With no way that the caller can request anything else.

So, on the basis that showing the first frame is better than a mid-media frame (make the video fade from/to black for example), I simply set the magic constant to 0 and recompiled.

Bingo.

The slide fades in to show the first frame, and the video starts from there. Exactly what the doctor ordered. What I don't understand is that when the video finishes, the last frame is now displayed. That too is exactly what's needed -- but I haven't a clue why: I expected it to jump back to the first.

I think the code is badly structured - the grabFrame method has no way of specifying an offset. It should have, and whatever runs the slide displaying should pick the first or last as appropriate.

Is it really so simple? And do the dev's lurk here at all, or do I need to stick this on the dev list??

Contributions gratefully received :slight_smile: It may be that no one ever really
looked at the problem or found the time to go back to that part of the code.

Best bet would be to introduce yourself on the dev list. They will ask
you to contribute the code via gerrit, the code submission tool that the
project uses and send in a mail about your contributions being released
under the relevant licenses the project uses. It will undergo a review
and if deemed acceptable and advantageous, which it seems to be from
what you relate, get accepted into the master source branch. If you're
up for introducing extra functionality to let the user choose where they
want to pick the frame from then even better :slight_smile:

Alex

I think the code is badly structured - the grabFrame method has no way
of specifying an offset. It should have, and whatever runs the slide
displaying should pick the first or last as appropriate.

Is it really so simple? And do the dev's lurk here at all, or do I need
to stick this on the dev list??

Contributions gratefully received :slight_smile: It may be that no one ever really
looked at the problem or found the time to go back to that part of the code.

Best bet would be to introduce yourself on the dev list. They will ask

OK; I've subscribed; I'd better just lurk for a bit.

you to contribute the code via gerrit, the code submission tool that the

gerrit?! something else to learn then :-{

project uses and send in a mail about your contributions being released
under the relevant licenses the project uses. It will undergo a review
and if deemed acceptable and advantageous, which it seems to be from

I have a sudden picture in my mind of a single-character change to the source generating vast swathes of review, comment, regression testing, etc etc. Hmmm.

what you relate, get accepted into the master source branch. If you're
up for introducing extra functionality to let the user choose where they
want to pick the frame from then even better :slight_smile:

I'd love to - but I'm so far out of date with code standards that I doubt it'd be practicable. The immediate problem is fixed^Wworked-around, and maybe the pointer to the trouble area will inspire someone more capable to do a proper job.

Oh, and thanks for the comments. A little encouragement goes a long way!

Mike.