can i add a small external video in to the middle of existing video by avidemux

Started by jraju, January 14, 2021, 10:46:49 AM

Previous topic - Next topic

eumagga0x2a

Quote from: butterw on January 18, 2021, 01:51:37 PMWhat does ADM_NO_PTS mean and is its Python value (-1) ?

ADM_NO_PTS is a reserved value to indicate a missing timestamp. Correct, it is equal -1 in Python ((uint64_t)(-1) in C++).

Quote from: butterw on January 18, 2021, 01:51:37 PMIf I understand correctly I would need to seek with adm.seekKeyFrame

Yes, you are right, I missed that. Bisect could speed up the process, but in the future it would make sense to be able to pass linear time to getNextKFramePts() to avoid this.

butterw

All these different times (Pts, Dts?) are really quite confusing.
With the latest dev build it's at least not too difficult to do the cut/paste insert operation manually. But there would still be a benefit to have a direct insert command if it can be done.


One unrelated thing I've noticed is that I get a seek error msg when I try to paste at the first frame.
The paste operation seems to go well though.
Before the paste, the first frame timestamp in the GUI is 66ms. After the paste, first frame is zero.

eumagga0x2a

Quote from: butterw on January 18, 2021, 05:47:18 PMOne unrelated thing I've noticed is that I get a seek error msg when I try to paste at the first frame.

Good catch, thanks, should be fixed now.

Quote from: butterw on January 18, 2021, 05:47:18 PMBefore the paste, the first frame timestamp in the GUI is 66ms. After the paste, first frame is zero.

This is expected.

butterw

Quote from: eumagga0x2a on January 17, 2021, 10:20:19 PMIf the first video wasn't edited yet (a single segment from 0 to its full duration fullDuration_0) , then the first segment is
adm.addSegment(0,0,currentPts)

The second one is the appended video:
adm.addSegment(1,firstFramePts_1,fullDuration_1)

The problem here is to get firstFramePts_1, i.e. the offset of the first frame relative to the start of the time in that reference video.

The third one is
adm.addSegment(0,currentPts,fullDuration_0)

I went though this with the TinyPy Shell, Avidemux crashed after I finished editing. But I noticed that ed.getVideoDuration() was not reported correctly, the value i gets added twice.

adm.clearSegments()
adm.addSegment(0, 0, i) # i is the insert point
adm.addSegment(1, f1, end1) # the inserted section
adm.addSegment(0, i, end0)
 
I also didn't succeed when trying to save the part-0b like this, which may be expected (output is truncated at end0-I):
adm.clearSegments() #duration is 0, clears the selection, but not the markers or position
adm.addSegment(0, i, end0)
adm.markerA = i
adm.markerB = end0
adm.save("B:/Videos/out/test0b.mp4")

butterw

Quote from: eumagga0x2a on January 17, 2021, 10:20:19 PMIf the first video wasn't edited yet, then the first segment is adm.addSegment(0,0,currentPts)
Is there a way to check whether the loaded video has been edited and why does it matter ?

I think it is possible to write TinyPy script functions that does the following:
1) if segments have been appended: save the loaded file (to out.mp4) and reload. 
2) splits and saves the video in two files (tmp1.mp4, tmp2.mp4) based on the current position.
3) reload and append the three segments (tmp1.mp4, insert.mp4, tmp2.mp4) then saves to out.mp4 (or opens a fileSave dialog).

This should achieve Insert on the current position with the current python bindings (though not very elegantly: it needs to save and reload two temporary files). To do better the issue referenced in my previous post would need to be solved or a built-in Insert command would be needed.

Who

Quote from: Who on January 17, 2021, 12:29:14 PM
Quote from: eumagga0x2a on January 16, 2021, 02:19:40 PMUnless you need AV1 decoding and VP9 encoding support, you can use the latest (not very fresh but oh well) Mojave nightly from https://avidemux.org/nightly/osx_mojave/ as it has that code change. In general, the idea is to build all macOS builds on Mojave as there is no easy way to generate backward-compatible builds on Catalina or Big Sur.

That should work fine in Catalina, so I downloaded and installed it and will see if it makes any difference.  Thanks!

Just wanted to pop back in to report that the newest Mojave build from that link did NOT work fine in Catalina.  There were two issues:  First, sound would not play while previewing, and second, the preview window would shrink down to a very small area of the screen.  Both of these were intermittent issues and if I closed and restarted the program sometimes one issue would disappear but then the other would show up.  I don't think either of these problems would affect actual encoding but they made editing difficult to impossible so I finally wound up going back to the previous version from my Time Machine backup.  I have no idea if these were only issues because I am running Catalina or not.

eumagga0x2a

The audio issue is due to the later fix [editor/audio] Enforce blockalign for (L)PCM only not present in that build. I cannot reproduce the issue with preview window shrinking down. I run Catalina too.

Obviously, I can generate a private build off git master and upload it to WeTransfer anytime if you wish. Official builds will happen when they happen.

Using Time Machine to revert an installation of Avidemux app bundle is a major overkill, IMHO.

butterw

With a few corrections, my insert script for Avidemux seems to be working now. It doesn't require temporary files.

https://github.com/butterw/bShaders/tree/master/test_LimitedRange (bInsert.py)

Feedback in the patch section.

Gew

Old thread, but still, "issue" or "feature request" remains strong, well at least on my behalf. Running latest Avidemux, appended clips are still put behind (at the end) of current video, and this cannot be changed by putting out cursor at a certain point or I-frame. I can, however, accomplish putting clips in the middle by (after first having it appended to the end) CTRL+X:ing / CTRL+V:ing (respectively) the appended part. This way I can save clips untouched (not re-encoded) รก la stream copy. But it would be one step less if there was a way to just append the clip to my located cursor point. Can we totally forget about (stop wishing for) this feature to appear in upcoming versions, or is there hope?