Avidemux Forum

Participate => User interface and Usability => Topic started by: TCmullet on May 30, 2023, 09:54:23 AM

Title: Suggestion: Save dialog's default file name extension case
Post by: TCmullet on May 30, 2023, 09:54:23 AM
My video capture allows me a choice of 3 file types and corresponding extensions, M2TS, TS, and MP4.  For a few years, I used M2TS, then realized TS is more suitable.  The capture system creates it's raw file with an extension of ".TS".  Notice the letters are upper case.  All along it has irritated me that Avidemux, in the Save dialog, changes that to lower case, i.e. ".ts".  I've never liked that.  I want all my TS files to have all caps "TS" as the extension.  I have to change it back every time I save anything.  Why do you interfere with the case that I have assigned to the original file (or in this case that the capture card has assigned to its created file)?  Please fix Avidemux to NOT change the case of the extension when pre-filling the file name for the Save dialog box.  I see no advantage to Avidemux tampering with the case of the extension that comes in.

As a former programmer, I realize there may have been a reason.  It may be that a bit of extra code would be needed to preserve the case when deriving the default name in the box.  But I'm sure it wouldn't be much.  It would be SO appreciated.

If it turns out that some DO like it to be converted to lower case, then maybe you could add an option switch and let the user decide their preference.
Title: Re: Suggestion: Save dialog's default file name extension case
Post by: eumagga0x2a on May 30, 2023, 10:42:44 AM
Avidemux (the MPEG-TS muxer) has no idea about the filename extension of input files (there may be multiple ones). The extension automatically added by muxer is hardcoded in the respective plugin.
Title: Re: Suggestion: Save dialog's default file name extension case
Post by: TCmullet on May 30, 2023, 11:18:03 AM
Quote from: eumagga0x2a on May 30, 2023, 10:42:44 AMAvidemux (the MPEG-TS muxer) has no idea about the filename extension of input files (there may be multiple ones). The extension automatically added by muxer is hardcoded in the respective plugin.
I don't know what you mean by "plugins" in this context.  Your muxers are part of Avidemux and source code is part of the Avidemux source code, isn't it?  I'm now remembering that when I used to use .M2TS, I had to change the ".ts" to ".M2TS".  I think I later learned that this was useless as the output file was really a .TS.  Thank you for your patience with my various ignorances.

And if the muxer (and it's source code) is not a part of Avidemux, then what IS the muxer a part of??

(I realize this may seem trivial, but I have a real-world case where I need to make a couple very simple changes to 900 video files, so those extra keystrokes to change the output extension add up.)
Title: Re: Suggestion: Save dialog's default file name extension case
Post by: TCmullet on May 30, 2023, 02:26:21 PM
My intuition tells me this suggestion is not feasible.  Therefore, I've decided to break my 10 year habit and let the editing TS's have the lower case extension, ".ts".
Title: Re: Suggestion: Save dialog's default file name extension case
Post by: eumagga0x2a on May 30, 2023, 06:27:10 PM
Avidemux is a modular application with many components (demuxers, muxers, video filters, video and audio encoders, even the tinyPy script engine) being implemented as plugins – as loadable shared libraries. Each muxer plugin exports a function getDefaultExtension(void) which returns a pointer to a C string (const char*) representing the extension (please see ADM_muxerInternal.h from avidemux_core/ADM_coreMuxer/include/ directory of Avidemux code tree). The MPEG-TS muxer plugin is defined here (https://github.com/mean00/avidemux2/blob/master/avidemux_plugins/ADM_muxers/muxerffTS/muxerffTSPlugin.cpp). This explains where ".ts" comes from.

It might make sense to implement getDefaultExtension() in the MPEG-TS muxer plugin in a custom way instead of using the ADM_MUXER_BEGIN macro for the reason of defaulting to .m2ts instead of .ts if the muxer is configured by user to output M2TS type of stream.
Title: Re: Suggestion: Save dialog's default file name extension case
Post by: sark on May 30, 2023, 11:09:07 PM
Advanced Renamer is a (free) renaming utility that can change the extensions of an entire folder of files to anything you want.
There are plenty of alternative ways to achieve this.

The following batch script in the same folder as your files can be used.

ren *.ts *.bak
timeout /t 5
ren *.bak *.TS

Note: Very large numbers of files may require the timeout value to be increased. Personally, I would use Advanced Renamer, you can reverse any changes at a later date, making it a safer option.
Title: Re: Suggestion: Save dialog's default file name extension case
Post by: eumagga0x2a on May 31, 2023, 10:06:29 PM
The MPEG-TS muxer should now be able to suggest capitalized filename extensions ".TS" for the ordinary MPEG-TS streams and ".M2TS" for the TS2 variety when an environment variable ADM_TS_MUXER_EXT_ALL_CAPS is set (the value doesn't matter, the code just checkes that this variable is present). Please try a future nightly.

On Windows, the user has to log out and log in again for an user environment variable to be propagated.