x11/mplayer: mkv seeking above 2GB broken with ffmpeg 4.2

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

x11/mplayer: mkv seeking above 2GB broken with ffmpeg 4.2

Christian Weisgerber
The update to FFmpeg 4.2 has introduced a regression in MPlayer. For (at
least) the ubiquitous H.264 videos in MKV containers, seeking in MPlayer
is broken, e.g. when jumping back and forth with the arrow keys. Effects
are desynchronized faulty video and failure to seek. This appears to
affect the parts of the video file beyond 2GB, seeking below is fine.
MPlayer prints warnings like
[matroska,webm @ 0x801b86f40]Element at 0x81e78160 ending at 0x81ff3e32
exceeds containing master element ending at 0x7e2ea500

--
Christian "naddy" Weisgerber                          [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: x11/mplayer: mkv seeking above 2GB broken with ffmpeg 4.2

Klemens Nanni-2
On Sat, Aug 17, 2019 at 04:28:31PM +0200, Christian Weisgerber wrote:
> The update to FFmpeg 4.2 has introduced a regression in MPlayer. For (at
> least) the ubiquitous H.264 videos in MKV containers, seeking in MPlayer
> is broken, e.g. when jumping back and forth with the arrow keys. Effects
> are desynchronized faulty video and failure to seek. This appears to
> affect the parts of the video file beyond 2GB, seeking below is fine.
> MPlayer prints warnings like
> [matroska,webm @ 0x801b86f40]Element at 0x81e78160 ending at 0x81ff3e32
> exceeds containing master element ending at 0x7e2ea500
Skimming mplayer(1) I could not find out quickly how to seek so far.

FWIW, mpv(1) works flawlessly seeking around in a 13.5G MKV container
with H.264 video on my X230 - this includes starting the video and
immediately seeking to the last few percents.

Can you tell me how to seek in mplayer and also try reproducing it with
mpv?

Reply | Threaded
Open this post in threaded view
|

Re: x11/mplayer: mkv seeking above 2GB broken with ffmpeg 4.2

Brad Smith-14
In reply to this post by Christian Weisgerber
On Sat, Aug 17, 2019 at 04:28:31PM +0200, Christian Weisgerber wrote:
> The update to FFmpeg 4.2 has introduced a regression in MPlayer. For (at
> least) the ubiquitous H.264 videos in MKV containers, seeking in MPlayer
> is broken, e.g. when jumping back and forth with the arrow keys. Effects
> are desynchronized faulty video and failure to seek. This appears to
> affect the parts of the video file beyond 2GB, seeking below is fine.
> MPlayer prints warnings like
> [matroska,webm @ 0x801b86f40]Element at 0x81e78160 ending at 0x81ff3e32
> exceeds containing master element ending at 0x7e2ea500

Does this resolve the issue?


Index: Makefile
===================================================================
RCS file: /home/cvs/ports/graphics/ffmpeg/Makefile,v
retrieving revision 1.190
diff -u -p -u -p -r1.190 Makefile
--- Makefile 17 Aug 2019 08:23:50 -0000 1.190
+++ Makefile 17 Aug 2019 15:57:05 -0000
@@ -4,6 +4,7 @@ COMMENT= audio/video converter and strea
 
 V= 4.2
 DISTNAME= ffmpeg-${V}
+REVISION= 0
 EPOCH= 0
 CATEGORIES= graphics multimedia
 MASTER_SITES= https://ffmpeg.org/releases/
Index: patches/patch-libavformat_matroskadec_c
===================================================================
RCS file: patches/patch-libavformat_matroskadec_c
diff -N patches/patch-libavformat_matroskadec_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-libavformat_matroskadec_c 17 Aug 2019 16:00:11 -0000
@@ -0,0 +1,26 @@
+$OpenBSD$
+
+avformat/matroskadec: Fix seeking
+
+matroska_reset_status (a function that is used during seeking (among
+other things)) used an int for the return value of avio_seek which
+returns an int64_t. Checking the return value then indicated an error
+even though the seek was successfull for targets in the range of
+2GB-4GB, 6GB-8GB, ... This error implied that the status hasn't been
+reset and in particular, the old level was still considered to be in
+force, so that ebml_parse returned errors because the newly parsed
+elements were of course not contained in the previously active and still
+wrongly considered active master element any more.
+
+Index: libavformat/matroskadec.c
+--- libavformat/matroskadec.c.orig
++++ libavformat/matroskadec.c
+@@ -757,7 +757,7 @@ static int matroska_reset_status(MatroskaDemuxContext
+                                  uint32_t id, int64_t position)
+ {
+     if (position >= 0) {
+-        int err = avio_seek(matroska->ctx->pb, position, SEEK_SET);
++        int64_t err = avio_seek(matroska->ctx->pb, position, SEEK_SET);
+         if (err < 0)
+             return err;
+     }

Reply | Threaded
Open this post in threaded view
|

Re: x11/mplayer: mkv seeking above 2GB broken with ffmpeg 4.2

Christian Weisgerber
In reply to this post by Klemens Nanni-2
Klemens Nanni:

> Skimming mplayer(1) I could not find out quickly how to seek so far.

Page up/down:      +/- 10 min
Cursor up/down:    +/-  1 min
Cursor right/left: +/- 10 s

> Can you tell me how to seek in mplayer and also try reproducing it with
> mpv?

On FreeBSD mplayer has the same problem, but mpv is fine.

--
Christian "naddy" Weisgerber                          [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: x11/mplayer: mkv seeking above 2GB broken with ffmpeg 4.2

Christian Weisgerber
In reply to this post by Brad Smith-14
Brad Smith:

> > The update to FFmpeg 4.2 has introduced a regression in MPlayer. For (at
> > least) the ubiquitous H.264 videos in MKV containers, seeking in MPlayer
> > is broken, e.g. when jumping back and forth with the arrow keys.
>
> Does this resolve the issue?
-snip-

Yes, it does!

--
Christian "naddy" Weisgerber                          [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: x11/mplayer: mkv seeking above 2GB broken with ffmpeg 4.2

Antoine Jacoutot-7
On Sat, Aug 17, 2019 at 08:01:01PM +0200, Christian Weisgerber wrote:

> Brad Smith:
>
> > > The update to FFmpeg 4.2 has introduced a regression in MPlayer. For (at
> > > least) the ubiquitous H.264 videos in MKV containers, seeking in MPlayer
> > > is broken, e.g. when jumping back and forth with the arrow keys.
> >
> > Does this resolve the issue?
> -snip-
>
> Yes, it does!

Then please commit :-)

--
Antoine