Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#1636 closed defect (fixed)

incorrect fps value from "sequence header" (ignoring division factor info in "sequence extension" relating to fps ?)

Reported by: apclinux@… Owned by: reimar
Priority: normal Component: core
Version: unspecified Severity: normal
Keywords: Cc: reimar, apclinux@…
Blocked By: Blocking:
Reproduced by developer: no Analyzed by developer: no

Description

Hello,

I recently posted a request info / bug report (last 4th January, see here after) about incorrect MPEG frame rate interpretation
by MPlayer and, as suggested by Reimar Döffinger, I just tried to upload the first 4 MBytes of my 5 fps frame rate MPEG test file
that is unfortunately displayed at 30 fps by MPlayer if not forcing the '-fps 5' option.
I also tried to upload level 1 log messages generated when invoking MPlayer at command prompt when playing
my MPEG test file with and without forcing the correct frame rate:

ftp://upload.mplayerhq.hu/MPlayer/incoming/4MB_of_vsrec_ch1_21_record_in_1280x1024_format_at_5_fps.mpg
ftp://upload.mplayerhq.hu/MPlayer/incoming/4MB_of_vsrec_ch1_21_record_in_1280x1024_format_at_5_fps_with_forcing_fps_option.log
ftp://upload.mplayerhq.hu/MPlayer/incoming/4MB_of_vsrec_ch1_21_record_in_1280x1024_format_at_5_fps_without_forcing_fps_option.log

Unfortunately, all my tries to upload these 3 files fail systematically, so,
how to make these files available to anybody who could examine this frame rate bug ? As it is my first MPlayer bug-report ever in the related Bugzilla area,
is there another way to join files to a bug-report ?

Especially to Reimar Döffinger :

would you accept direct mail from me with 3 attached files I mentioned here
(that is, 2 x ".log" and 1 x ".mpg" files) ?

2 persons have already posted comments and point of view about my initial post :

  • Nico Sabbi said:

"IIRC the MPEG parsing code was never updated to correctly handle the

framerate extension, and (still IIRC) not even ffmpeg handles it"

  • Reimar Döffinger said :

"Please provide a sample file and also try playing with -demuxer lavf"

So, my initial questions are still the same:

  • How to make MPlayer interpreting the correct frame rate by exploiting "sequence header" (announcing pre-defined "30 fps" frame rate)

in conjunction with (NOT IGNORING) elements from "sequence extension" giving the frame rate division factor to be applied
to the "standard" frame rate value deriving from the standard frame rate index info read from "sequence header" ?

Please note that the interesting MediaInfo project/tool has been recently fixed about this MPEG technical details (see version 0.7.27 release of MediaInfo)
and is now reporting correct "5 fps" frame rate about my MPEG test file (v0.7.26 was previously reporting incorrect "0 fps" frame rate).

  • Could anybody indicate/suggest to me what MPlayer and/or ffmpeg source file(s) are concerned in reading/interpreting

MPEG "sequence header" and "sequence extension" from an MPEG file or MPEG stream data ?

Thanks a lot in advance, anymore help very appreciated. Kind regards.

Alain-Pierre
<apclinux@…>


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Previous bug-report post (dated from last 4th January) :

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

I'm looking for method(s)/object(s)/function(s) involved by MPlayer to retrieve informations
from an MPEG file, especially how it will read information fields from "sequence header" (start_code 0x00001B3)
and "sequence extension" (start_code 0x000001B5), because I obtain a 6X speed factor when trying to read
an MPEG video file which was encoded as 5 frames per second as MPlayer is thinking of a 30 fps video stream file...

I think it is because MPlayer (or 3rd-party library functions used by MPlayer ?) don't use properly mixed info between
"sequence header" and "sequence extension" which are well present in the MPEG file and have reliable detailed
information about the video stream according to MPEG standard...

Here below are valid informations in the MPEG file that don't seem to be taken into account properly by MPlayer:

inside "sequence_header":

frame_rate_code = 5 (=> "frame_rate_value = 30 fps", if ignoring or miss-interpreting

extension data information in the "sequence extension"...)

inside "sequence_extension":

frame_rate_extension_n = 0
frame_rate_extension_d = 5

as specified in the MPEG standard, the formula to calculate the effective "frame_rate" shall be

frame_rate = frame_rate_value * (frame_rate_extension_n + 1) / (frame_rate_extension_d + 1)

with "frame_rate_value" being hard-coded and deriving from "frame_rate_code", as specified by the MPEG standard.

With implementing the right standard formula, frame_rate shall be calculated as :

30 * (0 + 1) / (5 + 1) = 30 * 1 / 6 = 5 fps yyyeeeeeesssssssssss !!!

I recompiled MPlayer (on a Linux platform) with "-g" gcc compile flag, hopping to debug/run it step by step with "ddd",
but I didn't find what object/function is effectively reading or not reading the "sequence extension" data
to correct 1st level information data read from the "sequence header".

As more information to you, please notice that the interesting "MediaInfo" tool seems to have (same) problem
in its version 0.7.26 about mixing "sequence header" and "sequence extension" information, not (yet) applying
the right standard MPEG formula, deciding by mistake to take "frame_rate_extension_n / frame_rate_extension_d"
ratio from "sequence extension" as frame rate ( ! ) and ignoring frame_rate_code (frame_rate_value) from "sequence header"
because "frame_rate_extension_n" is zero ! So, MediaInfo displays an invalid "0 fps" frame rate as a result from
"0 / 5" division ! I sent an email about that to the french developper maintaining the MediaInfo tool
(suggesting to him what modification to apply to source code to obtain the right frame rate value,
as I tested/validated this modification by recompiling my own standard copy of MediaInfo source code).
He replied to me, acknowledging for suggested modification.

Hopping anybody can have a look at official source code of MPlayer and post an (approved) update,
many thanks in advance, it may allow me to play "slow" videos which are ok against MPEG stream packet
format, but unfortunately, almost all multimedia players are not ok with such "slow" encoded video streams !?
VLC is hanging with such vids, only Windows Media Player from Microsoft seems to sometimes accept decoding & displaying
of such vids at the right 5 fps frame rate display speed, but surprisingly announcing a 30 fps frame rate (!?) in the info window,
like SMPlayer/MPlayer...

It shall be noticed that other data information fields shall have to be also examined against being defined
partly in "sequence header" and partly in "sequence extension":

a good example (with potential "difficulty") is the "bit rate" which is defined as a 30bit value by the MPEG standard,
with 18 lowest bits named as "bit_rate_value" ( ! ) in the "sequence header" and higher 12 bits "bit_rate_extension"
in the "sequence extension"...

'hope my post can help to build a new version of MPlayer, because for now, I have to add the "-fps 5" option to MPlayer
to properly decode/render our slow 5 fps mpeg stream, but we would have a transparent solution/way to play such streams
without to have to specify the "-fps ?" option because we don't know the right fps before pre-decoding input files...

Kind regards & many thanks in advance.

Alain-Pierre
<apclinux@…>

Attachments (3)

4MB_of_vsrec_ch1_21_record_in_1280x1024_format_at_5_fps_without_forcing_fps_option.log (12.2 KB ) - added by apclinux@… 15 years ago.
log file 1
4MB_of_vsrec_ch1_21_record_in_1280x1024_format_at_5_fps_with_forcing_fps_option.log (15.5 KB ) - added by apclinux@… 15 years ago.
log file 2
1000KB_of_vsrec_ch1_21_record_in_1280x1024_format_at_5_fps.mpg (1000.0 KB ) - added by apclinux@… 15 years ago.
MPEG test file (1280x1024 format, 5 fps frame rate)

Download all attachments as: .zip

Change History (13)

comment:1 by apclinux@…, 15 years ago

comment:2 by apclinux@…, 15 years ago

by apclinux@…, 15 years ago

MPEG test file (1280x1024 format, 5 fps frame rate)

comment:3 by apclinux@…, 15 years ago

4MB mpg file was too big, so tried again with attaching first 1000KB
of my original MPEG video test file.

comment:5 by reimar, 15 years ago

Sorry for taking so long to respond.
First, it seems you can get a somewhat correct frame-rate with -demuxer lavf -lavfdopts format=mpeg
Secondly, the functions you seem to be looking for are
mp_header_process_sequence_header
mp_header_process_extension
in libmpdemux/mpeg_hdr.c
In the (unfortunately unlikely) case that I get some time I'll try to look into it further.

comment:6 by reimar, 15 years ago

Actually, I sent a patch to support it to the mplayer-dev-eng list.
Note that it won't show the right number for -identify, but it will work for playback.

comment:7 by reimar, 15 years ago

Resolution: fixed
Status: newclosed

Should be fixed by SVN r30681

comment:8 by apclinux@…, 15 years ago

Cc: Reimar.Doeffinger@… added

(In reply to comment #7)

Should be fixed by SVN r30681

Hi,
when r30681 is supposed to be planned ?
I just downloaded http://www.mplayerhq.hu/MPlayer/releases/mplayer-checkout-snapshot.tar.bz2 which contains mplayer-checkout-2010-03-25 archive
and compiled it under a Linux session. The SVN version displayed when
running mplayer --help seems to be:

"MPlayer SVN-r29237-4.4.1 (C) 2000-2009 MPlayer Team"

Is it ok ? (I mean, r29237 vs r30681 ?)
I don't really understand, am I missing something ?
It will not display my 5fps test video mpeg file at right frame rate by default,
it is still detected/interpreted as 30fps by default, hu ? But now, when forcing
mplayer options "-demuxer lavf -lavfdopts format=mpeg", it will detect/interprete and render the right 5fps frame rate...

Is it wrong or normal ?

Thanks in advance for anymore help/suggestion.

Alain-Pierre

comment:9 by apclinux@…, 15 years ago

(In reply to comment #8)
Hello again,

in fact, I forgot to do the "make install" step.

The SVN version displayed when running mplayer --help is:

"MPlayer SVN-r30956-4.4.1 (C) 2000-2010 MPlayer Team"

It seems to be ok now vs "r30681"...

But still not ok by default with my 5fps mpeg test file, Hu ?

And some other video test file (NTSC 720x480 29,97 fps) will not be rendered
at all if mplayer forced with "-demuxer lavf -lavfdopts format=mpeg" options,
so I cannot use these options as to be my default mplayer setup to render
my 1280x1024 5fps Mpeg files and NTSC 720x480 29,97 fps without user action
at run-time ?

Thanks again for anymore help/suggestion.

Alain-Pierre

(In reply to comment #7)

Should be fixed by SVN r30681

Hi,
when r30681 is supposed to be planned ?
I just downloaded
http://www.mplayerhq.hu/MPlayer/releases/mplayer-checkout-snapshot.tar.bz2
which contains mplayer-checkout-2010-03-25 archive
and compiled it under a Linux session. The SVN version displayed when
running mplayer --help seems to be:

"MPlayer SVN-r29237-4.4.1 (C) 2000-2009 MPlayer Team"

Is it ok ? (I mean, r29237 vs r30681 ?)
I don't really understand, am I missing something ?
It will not display my 5fps test video mpeg file at right frame rate by
default,
it is still detected/interpreted as 30fps by default, hu ? But now, when
forcing
mplayer options "-demuxer lavf -lavfdopts format=mpeg", it will
detect/interprete and render the right 5fps frame rate...

Is it wrong or normal ?

Thanks in advance for anymore help/suggestion.

Alain-Pierre


comment:10 by reimar, 15 years ago

Sorry, the difference is a bit hard to see with that small sample file and my very slow PC.
Should now really be fix with SVN r30966.
But even your previous version at least should have displayed the right fps value.
And I and/or the FFmpeg developers probably would be interested in that other sample file that does not work with -demuxer lavf (but try without the -lavfdopts first, that will only break things).

Note: See TracTickets for help on using tickets.