News:

--

Main Menu

Issue with Xvid video in Avideumx 2.7.x

Started by mederi, July 22, 2019, 01:58:44 PM

Previous topic - Next topic

mederi

Recently I wanted to play some old videos in Panasonic Smart TV, but it had problem with the beginning of videos and I had to jump ahead a bit. Then I wanted to use Avidemux to investigate the issue with problematic files and to try to remux them or something. It seems that Avidemux 2.7.x win32 (tried 2.7.1 and 2.7.2 on Windows Vista) suffers the same issue and cannot properly decode older Xvid files. If I load the video and use right-arrow key to move 1 frame to the right, it jumps to a next key frame at 12 seconds. Older Avidemux 2.6.8 can move frame by frame properly so I used it to cut a sample. VLC media player can play these video files very well in PC.
Please could somebody help me to identify and name the cause of the issue of the file, what module/decoder and where should I report it so it can be fixed?
My investigation so far:
MediaInfo:
General
Complete name                            : D:\Xvid (Simple Profile L3), mp3.avi
Format                                   : AVI
Format/Info                              : Audio Video Interleave
File size                                : 926 KiB
Duration                                 : 13 s 240 ms
Overall bit rate                         : 573 kb/s

Video
ID                                       : 0
Format                                   : MPEG-4 Visual
Format profile                           : Simple@L3
Format settings, BVOP                    : No
Format settings, QPel                    : No
Format settings, GMC                     : No warppoints
Format settings, Matrix                  : Default (H.263)
Codec ID                                 : XVID
Codec ID/Hint                            : XviD
Duration                                 : 13 s 240 ms
Bit rate                                 : 288 kb/s
Width                                    : 640 pixels
Height                                   : 360 pixels
Display aspect ratio                     : 16:9
Frame rate                               : 25.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Compression mode                         : Lossy
Bits/(Pixel*Frame)                       : 0.050
Stream size                              : 466 KiB (50%)
Writing library                          : XviD 1.0.1 (UTC 2004-06-05)

Audio
ID                                       : 1
Format                                   : MPEG Audio
Format version                           : Version 1
Format profile                           : Layer 3
Format settings                          : Joint stereo / MS Stereo
Codec ID                                 : 55
Codec ID/Hint                            : MP3
Duration                                 : 13 s 212 ms
Bit rate mode                            : Constant
Bit rate                                 : 96.0 kb/s
Channel(s)                               : 2 channels
Sampling rate                            : 32.0 kHz
Compression mode                         : Lossy
Stream size                              : 155 KiB (17%)
Alignment                                : Aligned on interleaves
Interleave, duration                     : 36  ms (0.90 video frame)
Writing library                          : LAME3.98

MPEG4 Modifier v1.4.6 -> Video Info:
Packed bitstream:  No
QPel:              No
GMC:               No
Interlaced:        No
Aspect ratio:      Square pixels
Quant type:        H.263
FourCC:            XVID
User data:         XviD0035

I-VOPs: 2 (0,60%)
P-VOPs: 238 (71,90%)
B-VOPs: 0 (0,00%)
S-VOPs: 0 (0,00%)
N-VOPs: 91 (27,49%)

GSpot v2.70a: also indicates presence of N-VOP=DF (Duplicate Frames)

Sample: Xvid (Simple Profile L3), mp3.avi https://www120.zippyshare.com/v/Wl6LtORS/file.html

eumagga0x2a

Quote from: mederi on July 22, 2019, 01:58:44 PM
If I load the video and use right-arrow key to move 1 frame to the right, it jumps to a next key frame at 12 seconds.

Avidemux skips to the next keyframe only if decoding the next frame has hopelessly failed.

QuoteSample: Xvid (Simple Profile L3), mp3.avi https://www120.zippyshare.com/v/Wl6LtORS/file.html

I get a 403 (Forbidden) trying to load this link.

mederi

Try another one (this time "[ ] Set as Private Upload" checkbox disabled): https://www36.zippyshare.com/v/2eETTviM/file.html
The size of the sample is 0.9 MB so I cannot attach the file directly here (max 128KB). I can access the zippyshare file without any problem. Where should I upload it (some simple site, no registration)?

eumagga0x2a

Please try WeTransfer (no registration, no email address required, even if it looks like they would want one). I get the same "Forbidden" response for the new link.

eumagga0x2a

Interestingly, I get 403 from a nginx just trying to load the zippyshare.com homepage. Provider-side censorship?


eumagga0x2a

Thanks, this one worked, examining the file.

eumagga0x2a

Indeed, the decoding of the first GOP fails, starting with the second one everything is fine. This is probably related to the fact that frames 1-92 are empty (starting frame count at zero).

mederi

GSpot tools explains (tooltips) the N-VOPs frames
QuoteN-VOP's are VOP's with no actual content, 2 variations exist: PB and DF.
PB indicates presence of "zero-time" N-VOP's, "filler" VOP's used to create a so-called "packed-bitstream" ("PB").
DF = Duplicate Frame indicates actual (non-zero-time) N-VOP's: designates a picture is unchanged from the previous one.
According to this explanation the Xvid file contains DF frames that should prolong duration of previous frame (copy the first black frame to create several seconds of black screen). Then there are some more DF frames (not many) in a full file.

eumagga0x2a

#9
I believe to have identified the bug (which I have caused).

It is not that simple, restoring the handling of empty frames for mpeg4, cut off by [videoCodec][editor] Drain decoder to retrieve last decoded video frames + move to the new lavc API, alone doesn't allow Avidemux to handle the sample. Will look into it later.

mederi

So you are also Avideumx developer. Now I can see your nickname in Avideumux 2.7.2 Help > About: Mean / Eumagga0x2a, while there is only Mean in 2.7.1. There is also AUTHORS file in the folder, where you should also put your own stamp. Thank you very much for working on this project. People could donate it if there was any possibility (paypal).
So if I decide to contact Panasonic, I should ask them to fix their media player in TV to handle mpeg4 empty frames (N-VOP Duplicate Frames) properly. Is that right definition of the problem?

eumagga0x2a

It seems that your description is correct. I'll look into the issue in Avidemux, why libavcodec returns EAGAIN when the empty frame is passed to it and how it is supposed to work in general. It may happen that the fix will arrive too late for 2.7.4. You are the first one who noticed and reported the regression which persisted for one and a half years in code and for a year in official binaries.

I'm not really a developer, just a user-turned-into-developer for the sole purpose of fixing stuff in a tool I need (and giving back a little bit to the community). Money is absolutely not involved as well as there is no interest in putting my nick somewhere, but thank you for your friendly words.

mederi

#12
I have just tried the latest nightly build of Avidemux (avidemux_2.7.4 r190729_win32.exe). Thank you very much for prompt fix. Now I can access the first scene frame-by-frame, the MGM lion in the provided video sample. Please check the horizontal slider behaviour. If I drag it around the 0 position, the 12 seconds mushrooms of the next key frame are appearing there. Thank you for supporting Windows XP/Vista.
--- edit ---
So there is not a bug in a common codec library (libavcodec), is there?

eumagga0x2a

Quote from: mederi on July 31, 2019, 02:00:27 PM
Please check the horizontal slider behaviour. If I drag it around the 0 position, the 12 seconds mushrooms of the next key frame are appearing there.

A good catch, thanks. Should be fixed by [editor] Do not reject the first frame of reference video which starts at zero as candidate in getFrameNumFromPtsOrBefore().

QuoteSo there is not a bug in a common codec library (libavcodec), is there?

Unsure about it. But if the behavior is consistent and we can handle it, why not?

eumagga0x2a

Please try a 190804 build.

VC++ Windows 64 bits
MinGW Windows 64 bits
MinGW Legacy Compatibility Windows 32 bits