Avidemux Forum

Avidemux => Main version 2.6 => Topic started by: Bosanek on March 18, 2014, 07:04:44 AM

Title: Display of frame number in Avidemux v2.6.x
Post by: Bosanek on March 18, 2014, 07:04:44 AM
Hello!

I have been using Avidemux v2.5.6 for a long time. One of big reasons why I still have not switched to Avidemux v2.6.x is that it does not display the current frame number in the opened video (it displays only the exact time within video).

I downloaded and tried Avidemux v2.6.8 yesterday, and I see that it still does not display the frame number. Avidemux v2.5.x has that as a standard feature (and it works just fine even for H.264 material).

Why isn't the frame number displayed in Avidemux v2.6.x? Please add that feature, as it is very important when doing slice-editing: cutting parts of the video, splitting, merging, etc. with lossless (direct stream copy) output.
Title: Re: Display of frame number in Avidemux v2.6.x
Post by: Ice on April 29, 2014, 01:40:21 AM
I agree, this is a very important feature and makes adding fades and frame specific cuts in this program a serious pain.
Please add it back in the latest release! I would really appreciate to have frame accurate encoding...

The same as it was before the update, or at least a separate option to skip ahead to any frame in the video. Something similar to other programs (Virtualdub) etc.
Title: Re: Display of frame number in Avidemux v2.6.x
Post by: Jan Gruuthuse on April 29, 2014, 05:24:08 AM
avidemux 2.6.* branch is time based.
avidemux 2.5.* branch is frame based.
Title: Re: Display of frame number in Avidemux v2.6.x
Post by: Ice on April 29, 2014, 04:22:45 PM
2.6 has some important upgrades, but I suppose I can always just switch.

How can I run both without losing the other?
Title: Re: Display of frame number in Avidemux v2.6.x
Post by: Bosanek on April 29, 2014, 06:40:27 PM
I have noticed two very important issues in Avidemux v2.6.8 (and probably in all earlier v2.6.x revisions):


ISSUE #1: Added frames
-------------------------------

1. I load an input MP4 file (with H264 video stream in it) into Avidemux v2.6.8;
2. I select a portion of the recording (both A and B markers are on GOP boundaries);
3. I set input audio to "none";
4. I select "Direct stream copy" for video;
5. I save that portion into an output MP4v1, MP4v2 or MKV file (output format does not matter);

6. I load the output file in Avidemux v2.5.3 and I notice that it has 3 extra frames at the end! In other words, the output file, which was made from the section which was made in step 2, has at its end the three next frames which followed the "B" marker (those frames are outside of the selected zone in the input file)!

I tested the scenario above with at least three input MP4 files. It is repeatable. If I do all of the above with Avidemux v2.5.3, it produces a valid output file (the file does not have any extra frames at the end when compared to the selected zone in the input file).

An exception to this is the case when the "B" marker is at the very end of the input file. In that case, the program behaves exactly like in issue #2 (read below).


ISSUE 2: Missing frames
------------------------------

1. I load an input MP4 file (with H264 video stream in it) into Avidemux v2.6.8;
2. I do NOT select any portions of the file (that means that the entire input file is "selected");
3. I set input audio to "none";
4. I select "Direct stream copy" for video;
5. I save the input file into an output MP4v1, MP4v2 or MKV file (output format does not matter);

6. I load the output file in Avidemux v2.5.3 and I notice that it is missing the last three frames from the  end of the input file!

If I do all this with Avidemux v2.5.3, it produces a valid output file (the output file is not missing any frames from the input file).

I have tested this with multiple input files, and the issues are repeatable.
Title: Re: Display of frame number in Avidemux v2.6.x
Post by: Jan Gruuthuse on April 30, 2014, 06:30:51 AM
You missed the point: avidemux 2.6.* is not frame based editor and as such you don't have total control on the frames issue.
Very basic explanation (as user) 2.6.* uses virtual frames. As a result some represented frames are not usable as start for video cut. Or as end cut for video that needs joining a part after it.
If you find 2.5.3 works best for certain job, I would suggest using that one for these jobs.
I use from time to time  avidemux 2.5.6 alongside 2.6.8. Both are installed on my computer.
Title: Re: Display of frame number in Avidemux v2.6.x
Post by: AQUAR on April 30, 2014, 08:21:32 AM
With Avidemux 2.6 the time reference against a frame is accurate for AVC streams.
With Avidemux 2.5 the time reference against a frame is not accurate for AVC streams.

The relationship between a frame time reference and its frame number is too complicated for AVC streams.
Hence not available in Avidemux 2.6 and probably inaccurate in Avidemux 2.5.

@Bosanek
QuoteI select a portion of the recording (both A and B markers are on GOP boundaries);
I tried your process, but I do not see any extra frames added from outside the selected GOP's.
Setting the A and B markers on Idr frames (by using avidemux I frame navigation) defines the selection:
starting with and including the Idr frame at A and ending upto but not including the Idr frame at B.
At least that is the result I got.
Title: Re: Display of frame number in Avidemux v2.6.x
Post by: AQUAR on April 30, 2014, 01:10:10 PM
@ Bosanek
I did lose 3 frames as per issue 2 you mentioned.
We are also getting a .1 sec audio shift and maybe its related!
Title: Re: Display of frame number in Avidemux v2.6.x
Post by: Jan Gruuthuse on May 01, 2014, 04:45:18 AM
Quote from: Ice on April 29, 2014, 04:22:45 PM
How can I run both without losing the other?
They should install alongside, can only confirm this for linux.
2.5.x has avidemux2* names
2.6.x has avidemux3* names
Title: Re: Display of frame number in Avidemux v2.6.x
Post by: AQUAR on May 01, 2014, 07:49:18 AM
That also applies to the windows versions.
I have 2.5.6 and 2.6.8 installer versions installed on the same system.
And, also on the same system are a few portable nightly revisions in separate folders.

You can run multiple instances of either/both at the same time without issues, except I would not recommend
recoding more than one media file at the same time.
 
Title: Re: Display of frame number in Avidemux v2.6.x
Post by: Bosanek on May 01, 2014, 06:19:42 PM
@Jan Gruuthuse and @AQUAR:

I understand the design differences of Avidemux v2.5.x and v2.6.x regarding frame positioning.

However, the two issues which I described above are definitely real issues. One can view them from the frame perspective (as I do), but you can also view them from the time perspective if you want. The issues are real.

In the bare essence, Avidemux v2.6.8 omits or adds a bit of video material from/to the selected zone of input video when saving the zone through direct stream copy to an output file. You can view that bit as a couple of frames, or as a couple of (dozen) miliseconds.

In essence of issue #1, Avidemux v2.6.8 includes slightly more video material in the output file than it was selected by A-B zone. The added bit is the one after the B marker.
In essence of issue #2, Avidemux v2.6.8 excludes a bit of video material in the output file, compared to the selected A-B zone. The omitted bit is the one just before the B marker.

All A and B markers were set on "Intra frame" ("I-FRM") positions (positions which Avidemux goes to when using the UP and DOWN keyboard buttons). Therefore, there is absolutely no reason for Avidemux to omit or include more video around the I frame on which the B marker is set.

FYI: The input video files are from GroPro Hero 1, and also from Hero3+ Silver cameras.

P.S.:
@AQUAR:
QuoteI tried your process, but I do not see any extra frames added from outside the selected GOP's.
Setting the A and B markers on Idr frames (by using avidemux I frame navigation) defines the selection:
starting with and including the Idr frame at A and ending upto but not including the Idr frame at B.
At least that is the result I got.

Was the A marker at the very beginning of the file or somewhere in the middle (but before the B marker of course)? And was the B marker at the very end of the file or somewhere in the middle?
Title: Re: Display of frame number in Avidemux v2.6.x
Post by: Ice on May 01, 2014, 06:33:07 PM
My only concern is the wish to add fades more easily, maybe a sort of dissolve feature?

I am splicing multiple clips together and having to add multiple fade in-outs is a bit tedious.

Any other alternatives?
Title: Re: Display of frame number in Avidemux v2.6.x
Post by: AQUAR on May 02, 2014, 04:35:34 AM
@ Bosanek
QuoteWas the A marker at the very beginning of the file or somewhere in the middle (but before the B marker of course)? And was the B marker at the very end of the file or somewhere in the middle?
Selected segment is any random segment a few gops long.
Selected segment was chosen so that the end (B) was on a scene change so as to make it easy to see unwanted material.

A wild guess on Issue1:
Maybe the video has an open GOP structure - meaning virtual frames inside one GOP is referencing frames from adjacent GOPS.
Avidemux 2.6 is not in control of the frame ordering, so the decoder needs to pop out extras up to the referenced frame in the next GOP.
(else it cannot build the virtual frames in the selected GOP). Hence a few extra frames! 
As I said, that is just my wildest guess and probably totally wrong.   

And I agreed with Issue2:   
Title: Re: Display of frame number in Avidemux v2.6.x
Post by: Jan Gruuthuse on May 02, 2014, 04:50:49 AM
Quote from: Ice on May 01, 2014, 06:33:07 PM
My only concern is the wish to add fades more easily, maybe a sort of dissolve feature?

I am splicing multiple clips together and having to add multiple fade in-outs is a bit tedious.

Any other alternatives?

You should not hijack a posting, and created your own for discussion.
There is only the fade filter, applying fade filter involves re-encoding the complete clip/film.
I don't see alternative doing so.
Title: Re: Display of frame number in Avidemux v2.6.x
Post by: Jan Gruuthuse on May 02, 2014, 05:26:19 AM
Quote from: AQUAR on May 02, 2014, 04:35:34 AM

A wild guess on Issue1:
Maybe the video has an open GOP structure - meaning virtual frames inside one GOP is referencing frames from adjacent GOPS.
Avidemux 2.6 is not in control of the frame ordering, so the decoder needs to pop out extras up to the referenced frame in the next GOP.
(else it cannot build the virtual frames in the selected GOP). Hence a few extra frames! 
As I said, that is just my wildest guess and probably totally wrong.   

And I agreed with Issue2:

@AQUAR, Issue2 is related to Issue1. Virtual frames, relying on previous/future frames, ...

@Bosanek, If you want developer to look at your issues, provide developer with the camera(s) or the original footage produced with the camera.
You have to get out of the mind frame how avidemux should work according to you. Of course the easy way is to blame nasty bugs in avidemux.
Has nothing to do with the used OS, hardware, installed codecs or even user error, ....

Yeah and I've looked for original footage to download, 20 minutes or more. Could not find any, only stuff handled by vimeo or youtube and so no longer original recordings.
Oh and I could no longer find any reference to GoPro Hero 1 on the official GoPro website.

I've done enough ...
Title: Re: Display of frame number in Avidemux v2.6.x
Post by: AQUAR on May 02, 2014, 11:45:14 AM
With issue 2, I simply tested by copying/remuxing everything (ie without setting the A and B markers).
No decoding takes place in a "simple " remux, referencing is not taking place and hence you would expect all the frames to be there.

But in doing so the last 3 frames are missing (ie approx .1 sec).
Perhaps its co-incidental that audio is also shifted by approx .1 sec (as mentioned previously by zak).

With issue 1, you also are doing a "simple" remux if doing Iframe to Iframe with closed GOPs.
And cutting at any other frame type we know gives orphaned frames (unless recoding of course).
But what happens when cutting segments at GOP boundaries when these are open GOP (do we get extra frames!)?
AVC also has Idr frames and cutting on those should be fine (it's what avidemux does).

Anyway, it was just a bit of curious postulating at enduser level.
And in the scheme of things these are just tiny "flaws" IMHO.
Title: Re: Display of frame number in Avidemux v2.6.x
Post by: Jan Gruuthuse on May 02, 2014, 01:15:35 PM
It is more complex:
QuoteIDR-frames

IDR frames are: An IDR frame is what has been traditionally known as an I frame. An IDR frame, just like an I frame in MPEG-1/2 and MPEG-4 ASP, starts with a clean slate, and all subsequent frames will make reference to the IDR frame and subsequent frames. Non IDR I frames should be rare, but since they cannot be ruled out, enforcing a minimal IDR interval can help improve compression in some high motion scenes. In H.264/AVC you can also have I frames inside a GOP, which are not seekable, since the long time references introduced in H.264/AVC could result in a P frame after the I frame to reference a P frame before the I frame.

Max IDR-keyframe interval indicates the maximum distance between two IDR frames. Similarly, Min IDR-keyframe interval indicates the minimum distance between two IDR frames.
notice the bolded intriguing part.

source:
http://www.avidemux.org/admWiki/doku.php?id=tutorial:h.264#idr-frames
additional frame info: http://www.avidemux.org/admWiki/doku.php?id=tutorial:h.264#frame
Title: Re: Display of frame number in Avidemux v2.6.x
Post by: AQUAR on May 02, 2014, 02:06:25 PM
Thats for sure.
Luckily avidemux seeks only to the Idr frames if the video is compressed with AVC (with I frame navigation!).

The OP did mention putting the B marker on an I frame but probably meant Idr frame.
Hence the nature of the response.

Title: Re: Display of frame number in Avidemux v2.6.x
Post by: Bosanek on May 02, 2014, 07:05:43 PM
I am glad to see that you people have really made interest in these issues. Yes, I was always referring to IDR frames (I suppose that those are the frames that Avidemux always jumps to when using UP and DOWN keys on the keyboard?).

I would be more than happy to provide you with any source video materials which you need. We could share them through Dropbox maybe?

I have some source videos from my Gopro Hero 1 camera (fixed GOP length at 60 frames, around 8 Mb/s), and from my GoPro Hero 3+ Silver camera (fixed GOP length at 32 frames, around 14 Mb/s).

Just say which footage you want, and of what length.
Title: Re: Display of frame number in Avidemux v2.6.x
Post by: Bosanek on May 03, 2014, 01:17:47 PM
Here are two source files from GoPro Hero 1 camera:

https://dl.dropboxusercontent.com/u/45323798/Test1.mp4
https://dl.dropboxusercontent.com/u/45323798/Test2.mp4

Since I have no short/small files directly from the camera (all footage is at least several minutes long), i loaded one of those original camera files in Avidemux v2.5.3, made two relatively short "A-B" selections on GOP boundaries (by UP and DOWN keyboard keys), and saved each selection as one of these two test MP4 files. Processing was "direct stream copy", of course.
Title: Re: Display of frame number in Avidemux v2.6.x
Post by: AQUAR on May 04, 2014, 02:22:45 AM
@ Bosanek

I think your observations (issue 1 and issue 2) are probably the result of the complexity involved in editing h.264 streams and comparing results using two different editing approaches (avidemux 2.5 and 2.6).
That doesn't mean you observation of extra frames is incorrect. But as to the why and significance of them, that is a ?.

Most avidemux endusers don't have an in depth understanding of these aspects.
Probably only Mean (the developer of avidemux)  knows h.264 and his creations with that level of expertise.

I suspect the why is too complex and of little interest but a few endusers.
Significance might be addressed?

Did DL the Test1.pm4 just out of curiousity and do have two "NOOB" observations:
First thing to note was that the video doesn't start at an Idr frame (so avidemux 2.5 has an AVC problem cutting on Idr frames?).
Second is that Mediainfo shows M=3 N=15 for GOP formatting, but the interval between Idr frames is 60 for this video.

I think that means its a long GOP - probably open GOP and has refresher I frames (seen as P frames!) in between.
So - extra editing complications with an already difficult to edit compressed format.

It would be nice to know if these extra frames are the result of the avidemux "time based" model wrt:
a) some H.264 strategies used and b) are they an unwanted side effect or are they neccesary for proper decoding of all frames up to the end of the video.
Title: Re: Display of frame number in Avidemux v2.6.x
Post by: Jan Gruuthuse on May 04, 2014, 08:57:10 AM
You can avoid these small issues if you don't use stream copy for video, but re encode the video. Selecting markers [ A] [B ] is not required with up/down arrow keys in this case. And you have some more control of the edit. Disadvantage: time consuming as this process is quite slow, average 150 fps instead of 1800 fps for SD video. Depending available processing power cpu/gpu.
Title: Re: Display of frame number in Avidemux v2.6.x
Post by: AQUAR on May 04, 2014, 09:45:12 AM
I kind off have the opposite view viz, these issues are too small to consider taking the recoding route.

On balance:
Some cutting limitations, maybe a few extra/fewer frames and a fast result.
Versus.
Recoding lossy compression with inevitable quality loss, frame accurate cutting and slow result.

If you have to recode to another compression standard anyway then the choice is already made.

I think lots of people on this forum report issues with too much drama, and have unreachable expectations.
It's the same on other forums I participate in.