Adding a still image at the start of a video

Started by kramer97, January 31, 2024, 03:28:38 PM

Previous topic - Next topic

kramer97

Hi all,

I'm looking to do add a still introductory image to a video for 3-4 seconds in length.  In addition, I want to stitch and add 6 videos produced from a gopro.  I just started using Avidemux and still getting familiar with it.  It was extremely easy to stitch the video and export the video in the original audio/video codecs but i'm having issues with adding the still image.

I've already made a few attempts with importing the image in to Avidemux by:
1. Creating the still image filter
2. Changed the fps to match the same value as the gopro footage
3. Audio - Select track, created a custom audio track (this was required)
4. Exported as MP4

I used video output mpeg4 AVC x264, audio output mp3 audio, and output format mp4.

I then added this intro video along with the gopro videos and generated the full video.  Basically the end result was poor audio and video quality throughout.  I need some assistance as I'm not too familiar with post producing video.

Simply put, I want to retain 100% original audio and video of the gopro videos (copy) and add the 3-4 second still image at the beginning (it doesn't need to have audio if not required).  Would I have to somehow copy/import and mirror all of the video/audio codecs from the gopro and recreate the 4 second intro video so I can import it along with the gopro videos and use copy audio/video outputs to retain the quality? Or is their another easier way for me to accomplish this?

Thank you!

szlldm

You can only use the copy mode if the appended videos have the exactly the same coding.
Otherwise you have to re-encode the whole video (which is the case if you want to append the still image video to the gopro video). At the "Video output" change Copy to the preferred encoder (in doubt choose Mpeg4 AVC (x264)), same goes to Audio output, change Copy to smthing else.

eumagga0x2a

Just one small correction: the properties (sampling frequency, number of channels and channel layout, codec and codec settings) of the audio track(s) of the intro video must match the properties of audio track(s) of the following GoPro video. Final re-encoding of the audio track is not necessary and won't help if audio doesn't match.

Regarding the quality of the output, a minor quality loss is inevitable. Please attach the output of MediaInfo for the GoPro video to your reply in order to allow some assessment regarding choice of codec and its settings for the final re-encoding step.

eumagga0x2a

One addendum: a poor quality of re-encoded video may originate from post-processing other than HDR tone mapping not being disabled in Avidemux Preferences.

Very old Avidemux versions defaulted to post-processing (image denoising and deringing) being enabled by default. This was changed a long time ago, but Avidemux obeys existing configuration. Please make sure post-processing (the default settings in the Preferences AND the current settings for the actually loaded video in the "Video" menu) is completely disabled.

sark

@eumagga:

On the latest (and previous) win64qt5 zipped nightly, I can append a video to an image, but cannot append an image to a video (or to an image).
Tested by saving the image from the video, so not a resolution issue.
Could this be an Avidemux version issue, or my antiquated Win 7 OS.

eumagga0x2a

@sark, works fine for me. Of course, the B marker must be set to the total duration of the video for selection to include the last picture.

sark

#6
Quote from: eumagga0x2a on February 01, 2024, 06:13:50 PM@sark, works fine for me. Of course, the B marker must be set to the total duration of the video for selection to include the last picture.

The issue was not exporting, but importing as an append. However, I've now solved the issue, although I still consider it a bug.
The image will not import/append if it has a numerical name. For example, I can't append an image named 1.jpg, or 2.jpg.
Not a major issue, just need to remember to name approprately if appending images.

eumagga0x2a

Quote from: sark on February 01, 2024, 06:43:43 PMThe image will not import/append if it has a numerical name. For example, I can't append an image named 1.jpg, or 2.jpg.

Should be fixed by [file_qt4] Convert filenames to native directory separators on Windows, thank you very much for noticing and reporting this regression.

eumagga0x2a


sark

Quote from: eumagga0x2a on February 04, 2024, 04:37:19 PMBuilds incorporating the fix are available.

Thankyou.

On a related issue. If I make a selection at the end of a clip, and cut (Ctrl+X) the selection, when I paste it back to the end of the remaining clip, both video and audio are present. I can paste multiple times and the audio will be present on the pasted section. However, if I first append an image to the end of the remaining clip, when I then paste, after the image, only the video is present, the audio is lost.
Is this normal behaviour.

eumagga0x2a

Quote from: sark on February 05, 2024, 12:16:12 PMIf I make a selection at the end of a clip, and cut (Ctrl+X) the selection, when I paste it back to the end of the remaining clip, both video and audio are present. I can paste multiple times and the audio will be present on the pasted section. However, if I first append an image to the end of the remaining clip, when I then paste, after the image, only the video is present, the audio is lost.
Is this normal behaviour<?>

Yes, it is. Switching to a video segment without audio like the appended image terminates the audio track.

sark

Quote from: eumagga0x2a on February 05, 2024, 12:32:42 PM
Quote from: sark on February 05, 2024, 12:16:12 PMIf I make a selection at the end of a clip, and cut (Ctrl+X) the selection, when I paste it back to the end of the remaining clip, both video and audio are present. I can paste multiple times and the audio will be present on the pasted section. However, if I first append an image to the end of the remaining clip, when I then paste, after the image, only the video is present, the audio is lost.
Is this normal behaviour<?>

Yes, it is. Switching to a video segment without audio like the appended image terminates the audio track.

So both video and audio is cut, and both can be pasted back, but not after an image. I guess there's a reason for this?

eumagga0x2a

Appending an image creates a video segment without an audio track. Audio decoder requires an uninterrupted flow of packets. If there is a gap because we switch to a segment with a different reference video that has no audio tracks, the only IMHO clean approach is to terminate the track at the segment boundary. Yes, it means that a user needs to create an audio track for the image and append the image already muxed together with this track e. g. into a MKV (if it works) or AVI.

sark

So basically, whether the image requires audio, or not, if we want to insert that image into the middle of a track the logical approach is to:

Split the track, encoding each half with the same settings. I'm assuming we are not on I frames.

Open the image, and encode with above same setting.

Append the three clips and export in copy mode with no further encoding.

This would only require one encode, which would be necessary anyway, if appending an image. I guess this is where multitrack editors come into their own.

eumagga0x2a

You probably don't want the image to fly past the eye of the viewer within a tiny fraction of a second, so you need to generate a video from the image, a video with a matching audio track. Choose a lossless codec for that. Then append it to the original video and perform whatever editing steps (copypasting, deleting, filtering) you need. Re-encode the whole thing.

This way you achieve the same goal with higher flexibility.