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

jraju

Hi, i know how to copy part of video by markers a and b end point and copy and paste the same to the desired point in the video.
can i do the same, with external small video file at the reqired point in timeline
If i choose append, then it adds to the end of the file.
could you give ideas how to do it

eumagga0x2a

Append first, set markers accordingly to select the appended video, then use cut and paste (Ctrl+X followed by Ctrl+V at desired point in timeline) instead of copy and paste (Ctrl+C && Ctrl+V).

If you need to be able to paste independently from the frame type and internal structure of the video stream, set video encoder to a real encoder instead of "copy".

butterw

Quote from: jraju on January 14, 2021, 10:46:49 AMcan i do the same, with external small video file at the reqired point in timeline
If i choose append, then it adds to the end of the file.
In Avidemux appends are always at the end.

butterw

No file Insert feature is currently available and it's not ideal.
No marker is set by the append, you need to find the beginning keyframe of the segment.
Then after you cut, you also need to delete the first frame of the cut section, (not currently deleted by default when you cut to the end).


Who

The feature I'd really like is the option to replace a portion of video only with an equal length section, probably using a filter, without touching the existing audio track in any way.  So you would specify the starting point for the replacement (using the time stamp) and it would replace the existing video with the video from the alternate file starting at that point and continuing until it runs out of frames and then switch back to the original video (alternately perhaps a length to replace could also be specified).

I asked about this once before and a really kludgey way to do it was suggested, but when I tried that it threw the audio slightly out of sync with the video for the entire file.  So if they ever do add an insert feature as suggested here I hope that there will be an option to insert OR overwrite, and that you can specify to insert just the video, just the audio, or both from the alternate file.  I do realize that both files would have to be in exactly the same format for this to work but then that is also true with an append operation.

In the meantime you could concatenate files using ffmpeg; in the list of files to concatenate you'd have the main file, then your insert, then the main file again.  ffmpeg can concatenate these losslessly if you use the -c copy option, and then you can bring the full file into Avidemux and trim out the parts you don't want and do any other editing you need to do.  It is kind of a pain in the butt to do it that way, especially since ffmpeg doesn't have a super simple method to concatenate files, but it is a way to get the job done.

eumagga0x2a

Quote from: butterw on January 14, 2021, 01:38:22 PMNo marker is set by the append, you need to find the beginning keyframe of the segment.

Solution: seek to the end of the video prior to appending the next one, then go to the next frame. Reset markers if necessary, then set the A marker to the current position.

Quote from: butterw on January 14, 2021, 01:38:22 PMThen after you cut, you also need to delete the first frame of the cut section, (not currently deleted by default when you cut to the end).

The idea is to avoid visual disruption for the user as she or he will have probably exactly this first frame of the appended video loaded in the video preview when cutting. If no more videos need to be appended, then there is no need to delete that solitary frame, it should be enough to place the B marker at an earlier frame before saving.

eumagga0x2a

Quote from: Who on January 14, 2021, 11:51:11 PMIn the meantime you could concatenate files using ffmpeg; in the list of files to concatenate you'd have the main file, then your insert, then the main file again.  ffmpeg can concatenate these losslessly if you use the -c copy option, and then you can bring the full file into Avidemux and trim out the parts you don't want and do any other editing you need to do.

Why easy when it can be complicated?

Quote from: Who on January 14, 2021, 11:51:11 PMI asked about this once before and a really kludgey way to do it was suggested, but when I tried that it threw the audio slightly out of sync with the video for the entire file.

Could you please point me to that topic? I guess this operation required extracting and importing the original audio track after replacing a part of the video. A constant A/V offset is easy to correct, but a situation where the start is in good sync but the part after the insert is not would be very difficult to handle.

jraju

Hi, if a length of a video is more than an hour, either you have to close the video viewing or open the video again and use the forward button to the required place to view the screen once again.
So, what i want is a kind of break after one hour, by way of , adding the title song frame for a few minutes, so that i Just close the video and again go to the required portion to see the next time.
When A and B are available in the existing video, to move or copy to any location of the video,
I want repetiion of the same A and B segment , alreadly saved from the same video having the same features in the particular time on the timeline
Is this not possible  with the latest available version. To make it clear, I want the same title song to be copied in al the sequence of files at the desired point in timelilne
I think the solution is not yet given for me

butterw

Quote from: eumagga0x2a on January 15, 2021, 01:13:57 AM
Quote from: butterw on January 14, 2021, 01:38:22 PMNo marker is set by the append, you need to find the beginning keyframe of the segment.

Solution: seek to the end of the video prior to appending the next one, then go to the next frame. Reset markers if necessary, then set the A marker to the current position.

This sequence of operations is quite easy easy to get wrong on first attempt (or if you repeat it many times).
Avidemux should be have a command to do it automatically. 

Easy Lossless insert:
- Position yourself on a keyframe
- Select Insert command >> choose the clip to be inserted in a file open dialog
- Avidemux inserts the clip before the keyframe (warns of possible issues if applicable).
 

Quote from: eumagga0x2a
Quote from: butterw on January 14, 2021, 01:38:22 PMThen after you cut, you also need to delete the first frame of the cut section, (not currently deleted by default when you cut to the end).

The idea is to avoid visual disruption for the user as she or he will have probably exactly this first frame of the appended video loaded in the video preview when cutting. If no more videos need to be appended, then there is no need to delete that solitary frame, it should be enough to place the B marker at an earlier frame before saving.

When I cut or delete something, I don't expect it to be still there. It also inconsistent with the behavior of cut/delete when not performed at the end (in this case, the displayed frame is deleted and it goes to the next frame).
https://avidemux.org/smif/index.php?msg=90671

If there wasn't this orphaned keyframe to contend with, maybe an Insert command would not be needed.



jraju

your quote Hi, butterw
Select Insert command >> choose the clip to be inserted in a file open dialog
- Avidemux inserts the clip before the keyframe (warns of possible issues if applicable).
Is that command available in avidemux now in the latest edition
i tried to locate but could not find it.
hi, why i am not receiving the answers in my email gmail

butterw

Easy Lossless insert: isn't currently available in Avidemux

the sequence of operations suggested by eumagga0x2a works, but is probably a bit hard to accomplish for a first time user:
https://avidemux.org/smif/index.php?msg=90704

Who

Quote from: eumagga0x2a on January 15, 2021, 01:32:45 AM
Quote from: Who on January 14, 2021, 11:51:11 PMI asked about this once before and a really kludgey way to do it was suggested, but when I tried that it threw the audio slightly out of sync with the video for the entire file.

Could you please point me to that topic? I guess this operation required extracting and importing the original audio track after replacing a part of the video. A constant A/V offset is easy to correct, but a situation where the start is in good sync but the part after the insert is not would be very difficult to handle.

https://avidemux.org/smif/index.php?msg=89791

And you are correct, the thing that is problematic is this:

Quote from: eumagga0x2a on September 20, 2020, 08:41:29 PMIf the other video has a matching audio track which you can use, the operation degrades to a straightforward copy and paste task, else the next step is to export ("Audio" --> "Save Audio") the audio track to a file.

...

Quote from: eumagga0x2a on September 20, 2020, 08:41:29 PMAdd an external audio track ("Audio" --> "Select Track" --> ".... Add audio track" for Track 1) if you can't use audio from video 2 for the duration of the patch.

You would THINK that would work but I have found that even if the edits are all near the end of the video, when you bring the audio back it is off a little right from the start; you particularly notice it when people are speaking.  And if I knew exactly how much it was off I could correct it using the audio Shift field, but I don't, and I detest the idea of trial-by-error or just guessing to get a good shift value.  I am kind of a perfectionist, and "close enough" isn't good enough for me.

eumagga0x2a

Quote from: eumagga0x2a on January 15, 2021, 01:13:57 AM
Quote from: butterwThen after you cut, you also need to delete the first frame of the cut section, (not currently deleted by default when you cut to the end).

The idea is to avoid visual disruption for the user as she or he will have probably exactly this first frame of the appended video loaded in the video preview when cutting.

I've modified the behaviour of truncateVideo() to match removeChunk() with regard to the start of selection i.e. to delete the frame at the A marker. If the start of selection matches the first frame of an appended video, the whole segment is deleted.

This brings back the UX problem of loss of current visual context, slightly mitigated as Avidemux now tries to jump to the previous keyframe instead of rewinding to the start of video.

eumagga0x2a

Quote from: Who on January 15, 2021, 11:40:50 PMAnd if I knew exactly how much it was off I could correct it using the audio Shift field, but I don't, and I detest the idea of trial-by-error

Are you aware of audio shift working in preview? It is not that you need to save video each time you modify the value. Of course, one needs to put some effort into finding the right sync, but this takes usually just a couple of minutes.

By the way, I think some issues with external audio causing loss of sync were fixed recently, e.g. for AC3.

butterw

Switching between multiple video and audio tracks is a feature only available in full video editors.

It should also be possible with an Avisynth script though, which can be loaded with Avidemux or Virtualdub.