X264, dropped B-Frames beyond 2 consecutives ?

Started by twinsun, February 04, 2013, 05:07:30 PM

Previous topic - Next topic

twinsun

Hello,

Dropped B-Frames beyond 2 consecutives.
Avidemux 261-r8449 zip (same problem on all previous I tried)

Cause : Mp4 Demux ?

Working on a H264 Mp4 HD file, I observe that Avidemux can't show more than 2 consecutives B-frame.
Browsing the video with right or left key it's easy to see, look at <Frame type> : never more than 2 B-Frame.
And <Time:> confirms the dropped one (000, 040, 080, 160!, ) ms.

Obviously, it appends when in low bit rate part of the video, like the tracking shot (the most irritating jolted results).

Avidemux can <Save> a <Copy> of a video cutting, free of default, no drop seen on media players.
But every try to re encode (x264), drops many frames, more or less. Or NOT, it depends on the original H264 video. Psss, so close to be so good  ::).
Not a surprising result, thanks to avidemux window screen wysiwyg spirit.

Regards.

mean


twinsun

#2
For Mean (working links attached),

I think these short files are representative.
Description in files title.
B-frames sequence are mostly in the looping.

mean

Thanks, but I got a permission denied by uploader

twinsun


twinsun

Dropped B-frames, more precision :

- The problem doesn't exist if :
I work on x264.mp4 files encoded from Mpeg(s) files by Avidemux.
I use 4 Ref frame and 4 B-frame max, and all is fine.

- The problem is working on H264.mp4 files, mine anyway.
(I join 2 samples. They look like SD upscaling, yes, this part of the original is like that, don't worry.)

In a 3 B-frames sequence, it's not the 3rd B-frame that disappears but the 2nd.
The 1rst B-frame got a DOUBLE time length, taking the place of the 2nd.
In a 2 B-frames sequence no problem.

- I just start avidemux (8449), touch nothing, just load a H264-aac-1080p.mp4, that avidemux shows quite immediately, and start to browse left and right, frame by frame to observe that.

And it's not just a cosmetic problem, since If I encode, x264 or XVID or ââ,¬Â¦ , this part of the file, I 'got' these missing B-frames in the final Mp4 or AVI or....
Frame by frame with a media player ââ,¬Å"showsââ,¬Â the holes, I notice the missing frames.
In real world, the video is not fluent, like micro freeze, or 25 fps video jerking to 12 fps.
When the original is just ok.

For now, knowing that, I only work on Mpeg, or mp4 encoded by Avidemux.
Need a tool to check max B-frame of an external file before using it.

mean

Using your samples, it seems the problem is not about encoding but about decoding
For an unknown reason yet, when decoding the input file, every 4 frames or so is detected as going back in time and dropper
i.e.

0 40 80 70 120 160
             ^ Dropped

So when encoded, there is a hole every time it happens
Checking what's going on

twinsun

Yes Mean,
that's what I try to explain in the first post of this topic.
And also why I suspect the mp4 demux.

Happy to see somebody taking the time to understand something not evident to perceive.
Avidemux is so helpful anyway, so close to be so good.
Fingers crossed.

Anything else :
I try r8459
X264 'Quantiser' page has all value at zero by default.
It could be better to keep default value of r8449 for example, just great in any case.
Zero by default for Quantisers will lead to 10 Giga bytes for an hour encoded mp4 file (Big joke).

mean

The pts of the 2 bframes are swapped
So instead of having

100 140 180 220

you have

100 180 140 220

Still looking why

mean

So far it seems like the mp4 timings are incorrect
How did you create these files ?

twinsun

I don't remember.
If you mean that the stroboscope of the running ball does not sound real on 'the original', you're right.
Rendering of the calculated move could be better.
But that's not the focus, isn't it.
The 'original' is a 25 fps all along (despite it is vfr capable), so timing between frame is a constant 40 ms.

- Load the file 'identical to original' both with Avidemux and for example Media Player Classic HC, side by side view.
Do a forward frame by frame, when the ball is in the loop (it's easier to see).
You will see that Avidemux drops some frames, MPC not, the missing frames we discuss on.
Where are these dropped frames ?

The 25 fps of the 'original', goes to a (25 fps Max, 12 fps Min) fps on the 'encoded' one (x264 encoder not involved it seems).
Due to missing frames ?

Again, half part of my H264.mp4 HD are well handled, but these ââ,¬Â¦ !?

-> I will join two other A and B files, a long regular panoramic shot (and regular drop got), from a DVB-T HD channel (France), witch do the same. Could they help.

twinsun

About you're question, not sure what you mean by created ?
These 2 files were done by Avidemux :
A is a 'Copy'
B an 'Encode' of the 'Copy'.

twinsun

Another try.
I record a DVB-T HD channel at the same time on two equipments.
One is .TS the other .MP4

There is no visible difference between them, frame by frame with MPC Media Player Classic.
MPC property for .TS :
Video: MPEG4 Video (H264) 1920x1080 25fps [Video - AVC (H.264), High Profile, Level 4.0, 1920x1080,
MPC property for .MP4 :
Video: MPEG4 Video (H264) 1920x1088 25.371fps [AVerMedia Video Media Handler - MPEG4 Video (H264) (eng)

There is a difference with Avidemux.
The.TS file is well handled, while the MP4 file has the B-Frame problem.

mean

The problem is that , according to the file itself, the display order should be
I0 B1 B2 P3

But when decoding, the display order is I0 B2 B1 P3

So depending if you trust the timing of the file or the decoder you have all frames or some are dropped
I've checked the file and avidemux seems to do the right thing

I strongly suspect a bug, that's why i asked how the files were created.
It is either a bug in lavcodec/avidemux or a bug in the avermedia software when putting  the timestamps on the frames


twinsun

I think we can trust the file. Me be it use some unusual parameters.

Ref to my previous post,
MP4 file (avermedia) is as well played as the TS (direct record) by MPC-HC, with no dropped frame.
DXVA option in MPC-HC, no problem too with the MP4 file.
I also tried VLC player. No problem with the MP4.

Just one DVB-T HD channel from Avermedia, it seems so far, has MP4 problem with Avidemux.
Only Avidemux can't handle correctly MP4s of this channel.
Quite only, I have an Akira media player set top box which has also problems with these MP4s.

My Avermedia drivers and softwares are up to date 20-12-2012.
Below a link to a today file with more regular B-frames dropped sequence. HD channel with SD up-scaling, be aware.

http://rapidshare.com/files/845188533/D-file_H264_doing_avidemux_to_drop_B-frame.mp4