News:

--

Main Menu

best practices for appending video clips

Started by Toner, March 17, 2020, 04:55:08 PM

Previous topic - Next topic

Toner

Hi guys,

I'm looking for information regarding the best practices for appending video clips.
I only ever seem to create a successful merger of video clips when the video clips are from the same source.
Otherwise there will be issues like the second clip slowing down (then cut off) or corruption artefacts appearing in the completed file.

As an example.

Here are the properties for video clip 1.



Here are the properties for video clip 2.



Prior to attempting to merge them, I used the resample filter to get them both 25fps.

You can see the first clip ended up being 25.025 FPS.

I've been saving them using the mp4 container.

eumagga0x2a

Quote from: Toner on March 17, 2020, 04:55:08 PM
I'm looking for information regarding the best practices for appending video clips.

The first rule is to use the latest nightly build for your platform --> https://avidemux.org/nightly/

QuoteI only ever seem to create a successful merger of video clips when the video clips are from the same source.

If you save the result in copy mode, then yes, all clips must share exactly identical codec settings. When you re-encode, it is enough that the size, display aspect ratio and, if possible, the frame rate match.

QuoteOtherwise there will be issues like the second clip slowing down (then cut off)

I can't think ATM of any other scenario than saving clips with frame rate mismatch using the AVI muxer to get this, but I may miss something.

Quoteor corruption artefacts appearing in the completed file.

If you save in copy mode, then yes, depending on codec settings (open GOP!), early B-frames following the first keyframe of the appended clip in the stream order may be not fully decodable as they depend on reference pictures belonging to the previous and now unavailable GOP. These frames are invisible when playing the clip as a separate file because the playback starts at the first keyframe, but these frames are shown before it (this is the main reason for many videos not starting at zero in Avidemux).

If codec settings of individual clips don't match, it is pure luck to see anything after the start of an appended clip at all.

QuoteYou can see the first clip ended up being 25.025 FPS.

I've been saving them using the mp4 container.

Please use the latest nightly, frame rate (actually, time base) handling has been reworked since the last release. I would also recommend to start with the source videos at the stage prior to the step

QuotePrior to attempting to merge them, I used the resample filter to get them both 25fps.

Toner

Thanks for the help. Downloaded the latest.
Still can't get it to work.
Both clips are now 25fps exactly but when I append the second clip, it is slowed down and clipped at the end.
I'm saving them as x264 AAC in an mp4 container. Then I tried a mkv container.
Even tried a resample filter on the entire clip.
Same result every time.

There must be something I'm missing?
has it got something to do with the bitrate of the two files?
or the frequency of the audios?

eumagga0x2a

Quote from: Toner on March 17, 2020, 11:12:00 PM
Both clips are now 25fps exactly but when I append the second clip, it is slowed down and clipped at the end.

Would you please start Avidemux afresh, reproduce again the problem, close Avidemux, then compress (zip or 7z) and attach the log file admlog.txt from %localappdata%\avidemux\ to your reply?

Are you able to reproduce this strange behavior just with short excerpts of the first and the second clip too? If yes, given the content is innocuous enough, could you please provide these excerpts as samples via WeTransfer (no email address required!), Mega, Dropbox or Google Drive?

eumagga0x2a

Quote from: Toner on March 17, 2020, 11:12:00 PM
has it got something to do with [...] the frequency of the audios?

I just missed that. Yes, please unify ( = re-encode the audio track with the "resample" audio filter applied) the sampling rate of the audio track prior to appending.

Toner

Quote from: eumagga0x2a on March 18, 2020, 12:51:11 AM
Quote from: Toner on March 17, 2020, 11:12:00 PM
Both clips are now 25fps exactly but when I append the second clip, it is slowed down and clipped at the end.

Would you please start Avidemux afresh, reproduce again the problem, close Avidemux, then compress (zip or 7z) and attach the log file admlog.txt from %localappdata%\avidemux\ to your reply?

Are you able to reproduce this strange behavior just with short excerpts of the first and the second clip too? If yes, given the content is innocuous enough, could you please provide these excerpts as samples via WeTransfer (no email address required!), Mega, Dropbox or Google Drive?

No problem. Thanks for the help.
Attached is the zipped logfile.

Here is a zipped folder comprising three files.
https://mega.nz/#!p5xVFa4K!G_h_qUK7g7ruQsw5ut1srF8e-BGkQPEvn4vc1jfS4-w

file p1.mp4 is clip 1.
file q1.mp4 is clip 2.
file r1.mp4 is my result of trying to append clip 2 to clip 1.

They are short clips.
clip 1 is 51.04 seconds.
clip 2 is only 6.6 seconds.
It's a fade in from black to still image with three piano notes.
you can hear the the notes have pitched down and then the last two were cut off.

you can watch them here on this video hosting service

clip one:
https://streamja.com/Wnn5r

clip two:
https://streamja.com/ZJJ0w

clip two appended to clip one
https://streamja.com/zNN5q

Toner

Quote from: eumagga0x2a on March 18, 2020, 01:30:27 AM
Quote from: Toner on March 17, 2020, 11:12:00 PM
has it got something to do with [...] the frequency of the audios?

I just missed that. Yes, please unify ( = re-encode the audio track with the "resample" audio filter applied) the sampling rate of the audio track prior to appending.

Thanks, I re-encoded both clips with this resample filter checkbox checked.
Then I appended them.
Seems to have worked.
Is that how to do it?


eumagga0x2a

Thank you for the log and the samples. In your case it would suffice to re-encode audio with downsampling to 44.1 kHz just for the closing sequence. In general, re-encoding both is failure-proof, but costs quality.

Unrelated to the topic, I would recommend to enable DXVA2 hw accelerated video decoding and especially the "DXVA2" (actually, simply DX = DirectX) video output in Avidemux preferences in order to preserve energy as with your current settings CPU does the whole job including scaling for display, which is computationally very expensive when performed by the CPU in contrast to doing it in the graphics card.

Toner

Quote from: eumagga0x2a on March 18, 2020, 02:56:22 PM
Thank you for the log and the samples. In your case it would suffice to re-encode audio with downsampling to 44.1 kHz just for the closing sequence. In general, re-encoding both is failure-proof, but costs quality.

Unrelated to the topic, I would recommend to enable DXVA2 hw accelerated video decoding and especially the "DXVA2" (actually, simply DX = DirectX) video output in Avidemux preferences in order to preserve energy as with your current settings CPU does the whole job including scaling for display, which is computationally very expensive when performed by the CPU in contrast to doing it in the graphics card.

Thanks so much. I was wonder if there was a way to get my GPU to do some of the work.

I've checked this box. Is that everything?


eumagga0x2a

Quote from: Toner on March 18, 2020, 08:36:52 PM
I was wonder if there was a way to get my GPU to do some of the work.

I've checked this box. Is that everything?



No, you should also set video output in the "Display" tab to "DXVA2".