News:

--

Main Menu

Inserting thumbnails to MP4

Started by tomer-k, August 21, 2021, 12:51:22 PM

Previous topic - Next topic

tomer-k

Hi,
This is the script I'm using to convert a series of videos from TS to MP4:

set avidemux="C:\Program Files\Avidemux 2.7 VC++ 64bits\avidemux.exe"
set videocodec=x264
for %%f in (*.TS) do %avidemux% --video-codec %videocodec% --save-raw-audio--force-alt-h264 --load "%%f" --save "%%~dpnf.MP4" --quit

Unfortunately, the files that this script is creating have no thumbnails.
Does someone know how to create the files with thumbnails, please?

eumagga0x2a

Quote from: tomer-k on August 21, 2021, 12:51:22 PMfor %%f in (*.TS) do %avidemux% --video-codec %videocodec% --save-raw-audio--force-alt-h264 --load "%%f" --save "%%~dpnf.MP4" --quit

This is a mess.

"--save-raw-audio" is used to save audio track in copy mode to a separate file and expects output filename as argument. "--force-alt-h264" is invalid since ages, both options without a space in between are obviously an invalid (ignored) option.

If you are happy with the default x264 configuration, it is OK to use "--video-codec x264", else you should use a project script.

"--save xyz.mp4" doesn't make "xyz.mp4" a MP4 file as you haven't specified "--output-format MP4".

"--load /path/to/source/video/filename.extension" should be the first argument as it may trigger output configuration reset.

Quote from: tomer-k on August 21, 2021, 12:51:22 PMUnfortunately, the files that this script is creating have no thumbnails.
Does someone know how to create the files with thumbnails, please?

I assume that you don't create MP4 files in the first place, and the thumbnailer used by Windows Explorer (if you are on Windows) is picky about container formats and video codecs.

If you want to add cover image to created MP4 files, this is not yet possible with Avidemux (the libavformat-based MP4 muxer potentially has this capability, but we don't have infrastructure to make use of it).

tomer-k

"--load /path/to/source/video/filename.extension" should be the first argument as it may trigger output configuration reset."

Thank you very much for your comprehensive explanation. I implemented everything you offered right away but just haven't understood what the load line means. Never used arguments before so hope it can be avoided.

eumagga0x2a

Quote from: tomer-k on August 21, 2021, 08:12:29 PMI implemented everything you offered right away but just haven't understood what the load line means

--load is an option which expects the path to the file as argument. In your initial version, --load "%%f" was almost at the end of the option list, but it should be the first one, right after Avidemux executable pointed to by the variable %avidemux%. All options and arguments must be separated by spaces. A batch script

set avidemux="C:\Program Files\Avidemux 2.7 VC++ 64bits\avidemux.exe"
set videocodec=x264
for %%f in (*.TS) do %avidemux% --load "%%f" --video-codec %videocodec% --audio-codec Copy --output-format MP4 --save "%%~dpnf.MP4" --quit

might work (I am not sure about the specific cmd.exe scripting syntax, but the Avidemux command line should be correct).

In doubt, please post your current version of the batch script.

tomer-k

Thanks again, hoping I'm doing it right this time:

set avidemux="C:\Program Files\Avidemux 2.7 VC++ 64bits\avidemux.exe"
set videocodec=x264
for %%f in (*.TS) do %avidemux% --load "%%f" --video-codec x264 %videocodec% --save-raw-audio- --output-format MP4 --save "%%~dpnf.MP4" --quit

Actually, the MP4 files created have their thumbnails anyway now. Lastly, with every creation of a new Mp4 file, there is also a new small file with the ending .ts.idx2. If I'm getting it right that's sound files. How can I cancel their creation, please?

eumagga0x2a

#5
Quote from: tomer-k on August 23, 2021, 09:56:30 PMhoping I'm doing it right this time:

Not yet :)

Quote from: tomer-k on August 23, 2021, 09:56:30 PMset avidemux="C:\Program Files\Avidemux 2.7 VC++ 64bits\avidemux.exe"
set videocodec=x264
for %%f in (*.TS) do %avidemux% --load "%%f" --video-codec x264 %videocodec% --save-raw-audio- --output-format MP4 --save "%%~dpnf.MP4" --quit

You are obviously not going to save audio as a separate file, therefore you should drop mutilated "--save-raw-audio" option which additionally lacks the mandatory argument. On the other hand, you might want to include --audio-codec Copy to explicitly specify copy mode for internal audio track(s).

Quote from: tomer-k on August 23, 2021, 09:56:30 PMActually, the MP4 files created have their thumbnails anyway now.

They always had. You didn't create MP4 files before (you created files of a different type with filename extension ".MP4"), so simple is that.

Quote from: tomer-k on August 23, 2021, 09:56:30 PMLastly, with every creation of a new Mp4 file, there is also a new small file with the ending .ts.idx2. If I'm getting it right that's sound files.

*.idx2 files are text files containing the index of the corresponding MPEG-TS or MPEG-PS file, they are created the first time Avidemux opens such a stream file and regenerated if they were removed or when the indexing scheme changes. Index files store video and audio stream properties and frame offsets.

Quote from: tomer-k on August 23, 2021, 09:56:30 PMHow can I cancel their creation, please?

This is not implemented and not really wanted as long as the filesystem is writable. These files allow Avidemux to open indexed MPEG-TS and MPEG-PS files instantly.