News:

--

Main Menu

Smart-Copy

Started by Spellbinder, December 25, 2013, 07:14:59 PM

Previous topic - Next topic

Spellbinder

First of all let me say thank you for your great work! I really like avidemux and use it very often. Mainly to cut commercials out of tv captures.

But there is one feature that I am missing very much: Smart-Copy

I am no developer so I canÃ,´t code myself, but I thought I give it a try from a business analyst point of view what it would take to implement this featureââ,¬Â¦

First of all letÃ,´s define what ââ,¬Å"smart-copyââ,¬Â means:

Copy mode is currently limited to cut only at I-Frames. Only way to cut at non I-Frames at the moment is to completely re-encode the complete video. Since re-encoding always reduces quality this is not good and takes quite a while, too. So to bridge the gap there is ââ,¬Å"smart-copyââ,¬Â. It will encode only the necessary parts at the cut-points and otherwise copy the video. So only a very small part of the video is encoded and the rest stays the same.

So what would it take to implement this?

1.   Identify the parts that need to be encoded. Avidemux already seems to check if cutpoints are I-Frames when in copy mode. So identifying the non I-Frames should be easy?
2.   Specify the exact from-to of the part that needs to be encoded. This would be the non-Iframe cutpoint until the next I-Frame (excluded).
3.   After all parts that need to be encoded have been specified they would need to be encoded. Avidemux can also do this right now as well 
4.   After all the necessary parts have been encoded avidemux would have to append all the parts together with the copy parts of the video in between. Appending is also already possible in avidemux.

Only questions left is what encoder setting to use. In my opinion they donââ,¬â,,¢t have to be perfect. We are talking about a very small fraction of the final video. So I would determine the video codec and the average bitrate and encode it with 2-pass using the same average bitrate. If you really would like to make it ââ,¬Å"fancyââ,¬Â determine the profile and levels (for h264) and limit the encode to that of the video you want to cut, so that they are not changed for the new video. Rest of the settings use ââ,¬Å"best-practicesââ,¬Â. Alternatively you can let the user do all the encoding settings himself when selecting ââ,¬Å"smart-copyââ,¬Â option.

Sounds easy? Or not? Let me know what you think about this concept and if it possible to implement.

Many Thanks!

Papou

User reply:
What you describe is what Avidemux (including 2.5) can already do with MP4 ASP (DivX etc).

What is wished is that it did it for MP4 AVC (H264) as well.

My present wish is that Avidemux warned that a cut is GOING TO be made at a non I frame, "are you sure?" so that the user can correct what he's doing, rather than warn BEFORE ENCODING that at cut is HAS BEEN made at a non I frame, at a time when it's practically impossible to correct what was done.

Regarding MP4 AVC smart copy, it's a pity that
1) instead of re-encoding, it does not seem to be possible to synthesize an I frame to replace the first kept P frame so that the following P frames would refer to them the same way.
2) it is not possible to mark frames as NON DISPLAY (skip) so that (on high speed CPUs anyway), decoding follows its normal course but small GOPs are skipped and only what is wanted is displayed.

AQUAR

Probably the same reason why you can't do partial.
That is - avidemux 2.6 is not in control of pulling out the required frames, as  needed to create a new IDR frame for orphaned frames at the cut points.

Papou

How then does Avidemux get "in control" to pull out the frames needed to reencode an orphaned frame set and to insert the reencoding at the cut point?

AQUAR

@ Papou
Avidemux 2.6 is aimed at being able to deal with AVC video.
The wiki explaines some of the changed approach taken to do that.

The question you pose is way to deep for an enduser to tackle.
Developers might repond here if it is considered value adding to us endusers (but I think not!).
Or update the wiki in the future for the curious geeks amongst us.

Version 2.5.6 handles PTS and DTS itself for frame re-ordering, so it can pull out any frame it needs to create a new IDR frame as reference for the recoded orphaned frames (ie the smartcopy process).
With version 2.6 the frame re-ordering is done by the decoder, because AVC is much more complex wrt these virtual frames.

Anyway, this is just my limited understanding of how these thing work, and I am often wrong.

lenildosb

#5
hi guys, smarty copy only working with version Avidemux 2.4 GTK+!!!! use is the best version of avidemux!!!!

styrol

Quote from: lenildosb on December 29, 2013, 10:45:19 PM
hi guys, smarty copy only working with version Avidemux 2.4 GTK+!!!! use is the best version of avidemux!!!!
Of courseââ,¬Â¦ it seems you've forgotten to delete version 2.4ââ,¬Â¦

lenildosb

instead of improving the program, they get worse!!so I use the version 2.4

AQUAR

I pity people who express opinions without ever including even a smidgen of substance.
Seems they tend to be, easily peeved, ignorant of merit and self centred/entitled.

So lenildosb, are you one of them?
If not can you be more specific as to why 2.4 GTK+ is the BEST ever version?

zakk

Quote from: AQUAR on December 31, 2013, 03:00:52 AM
So lenildosb, are you one of them?
Look at his posts, he is just trolling. Just stop answering.

AQUAR

So True - will do that from now on (ie add to my 'ignore list'!).

Papou


Spellbinder

So coming back to my initial post:

What does a daveloper think of my take of smart-copy? COuld it be implemented this way?

mean

For it to work, the encoder setting should be the same between the re-encoded part and the original part
If not, when using format such as .mp4, it will not work

UKenGB

I'm completely confused about SmartCopy. I'm using 2.6.7 on OSX Mavericks and I can find no option to set SmartCopy as suggested in the Wiki docs that as far as I know is the only available documentation. If it is no longer possible in 2.6, how is one supposed to e.g. cut from the beginning a section which doesn't end on an I Frame?

I have some very convenient black frames where I want to make the cut, but they're all B Frames and the next I Frame is too far. I want the resulting video to start with the black frame, but having made the cut, when trying to save I am warned that this is not good, but if I Save anyway, the video file won't play, e.g. Quicktime thinks it's over 4 hours long, when it's actually only 59 mins.

If instead I set the B marker to an I Frame, the resulting file is perfect. So it's obviously crucial to make cuts ending at I Frames which may not be where it is wanted - unless there is some smartness in the cutting process which now seems to be absent.

Is there some method of achieving cuts not on I Frames of which I am unaware?

Will we see the re-introduction of such 'SmartCutting' in the future?

If not, then at least the docs should be updated.