News:

--

Main Menu

Recent posts

#1
Documentation & Tips / Re: [Tinypy] Tips & docs on Av...
Last post by tripunto - Today at 11:28:50 AM
Quote from: butterw on May 14, 2021, 01:25:39 PM

ext="mp4"

adm=Avidemux(); gui=Gui()
# -------- select input directory --------
inputFolder = gui.dirSelect("Select " +ext+ " source folder")
# inputFolder = gui.fileReadSelectEx("Select input file", ext)

if inputFolder is None:
    gui.displayError(header_str, "No source folder selected"); return
# inputFolder = dirname(inputFolder)


# -------- get filelist with extension --------
filelist = get_folder_content(inputFolder, ext)
if filelist is None:
    gui.displayError(header_str, "No "+ ext +" files found in: "+ inputFolder); return

# -------- confirm dialog before batch --------
dlgConfirm = DialogFactory(inputFolder)
label_str = "Batch process " +str(len(filelist))+ " (" +ext+ ") Files in folder ?"
label = DFToggle(label_str); label.value=True; dlgConfirm.addControl(label)
fnames = DFMenu("in:")
for fname_in in filelist:
    fnames.addItem(basename(fname_in))
dlgConfirm.addControl(fnames)
if not dlgConfirm.show(): return

I'm trying to change the output file extension with:
dlgTitle = "Found "+str(nbSeg)+" segment(s) in "+str(e.nbVideos())+" video file(s)";
dlgConfirm = DialogFactory(dlgTitle);

out_ext = "mp4"
ext_list = ["mkv","webm","mov","avi","ts","m2ts","vob","mpg","wmv","mp4"]
set_ext = DFMenu("Output the segments in individual files with extension")
set_ext.addItem(out_ext)
for ext in ext_list:
    if not ext is out_ext:
        set_ext.addItem(str(ext))
dlgConfirm.addControl(set_ext)

But I get an error when trying to get the value of:
set_ext.value
For now, to avoid the error I have had to use:
if not dlgConfirm.show():
    g.displayInfo("CANCEL", "Canceled by user")
    return
else:
    try:
        if set_ext.value:
            out_ext = set_ext.value
    except TypeError:
        out_ext = "mp4"

How can you get the value of the DFMenu?


I'm also having trouble with appendVideo()
It doesn't return an exception, and I can't prevent the error window from appearing if I cut too short.You cannot view this attachment.
#2
User interface and Usability / Naming of filter "A.I. Enhance...
Last post by guju - April 27, 2025, 10:20:28 AM
The filter is not an ENHANCING (restauration) filter, as it's name lets expect,
but just upscaler (for factors 2, 3 and 4), based on A.I. models.

So my suggestion is to rename it to something like "Upscaler (A.I. based)"
so user may find it, and get what it's name lets expect.
#3
MacOSX / Re: Sonoma 14.7.2
Last post by eumagga0x2a - April 26, 2025, 10:25:51 AM
The Apple Silicon build instructions in the README (the lower part of https://github.com/mean00/avidemux2 when displayed in a browser) are sufficient. At what particular stage do you experience problems?
#4
MacOSX / Re: Sonoma 14.7.2
Last post by chriscjcj - April 26, 2025, 03:28:09 AM
@eumagga0x2a

Is there a good step-by-step for building from the git master? I was able to glean some information from this thread, but not enough for this novice to get the job done.

Grateful for any advice and consultation. 🙏🏻
#5
Unix-Like (Linux/Bsd/...) / Re: Problem with aspect ratio ...
Last post by Seojeom - April 22, 2025, 05:44:26 PM
OK; I downloaded the newer version and really tried to find a good combination of format parameters and DAR and display width, etc. Unfortunately, I didn't find one. The problem seems to be that the pixel count stayed at 720x576 and the Android phone regarded that as the deciding factor.

But the swsResize filter did the trick! Thank you!
#6
Unix-Like (Linux/Bsd/...) / Re: Problem with aspect ratio ...
Last post by Jan Gruuthuse - April 22, 2025, 04:10:56 PM
as explained above by eumagga0x2a
When using mp4 muxer in avidemux:
Output Format:
MP4 Muxer:
[Configure}
mark [v] Force aspect ratio
keep:
DAR at [16:9]
Display Width [1280]
#7
Unix-Like (Linux/Bsd/...) / Re: Problem with aspect ratio ...
Last post by eumagga0x2a - April 22, 2025, 04:01:38 PM
First of all, I would recommend using the latest 2.8.2 appImage from https://avidemux.org/nightly/appImage4Buster/ rather than the extremely outdated 2.8.1 release build which is meanwhile over two years old.

Quote from: Seojeom on April 22, 2025, 03:31:48 PMI recorded a short TS video file from digital TV that I want to share with some others with mobile phones. So I thought to use Avidemux to isolate the interesting part and to convert it to MP4 format (because that seems to be popular on phones.)

Not just the container format (MP4 vs MPEG-TS) matters but especially the video and audio codec as the video codec should be compatible with the hardware decoder capabilites of the target device. In doubt: H.264 as video and AAC as audio.

Quote from: Seojeom on April 22, 2025, 03:31:48 PM<...> the aspect ratio is a problem. The original video's aspect ratio is 16:9, as it is from a 16:9 TV. However, when Avidemux loads the file, it immediately changes (squeezes) it to 4:3, and this is kept in the output MP4 file. So the output is squeezed, in other words, useless.

<...> Looking at Output Format|Configure|Properties, it says "Image Size: 720x576" which seems to be wrong for a 16:9 image. On the other hand, "Aspect Ratio: PAL 16:9 (64:45)" which is wrong, too, as 16:9 is not equal to 64:45, and the output image's aspect ratio is, as noted above, 4:3 which is not equal either to 16:9 or 64:45.

It all makes perfectly sense. We've got an anamorphic video coded with pixel dimensions of 720x576 intended for display at pixel aspect ratio of 64:45 = 1024x576 which gives us 16:9 display aspect ratio as the result. Avidemux displays all videos by design as coded and with square pixels.

The main question is whether the (most likely MPEG-2) source is interlaced or progressive. If the former, you should insert a deinterlacing video filter (e.g. yadif) when re-encoding the video stream. When re-encoding, e.g. using the x264 video encoder plugin for H.264 output, you should a) in the configuration of the x264 plugin, in the "Output 1" tab, choose "64:45 (PAL 16:9)" as "Predefined Aspect Ratio" for "Pixel Aspect Ratio" and b) in the configuration of the MP4 muxer, check "Force aspect ratio" checkbox and select "16:9" as "Aspect Ratio (DAR)". Please note that the latter is more important as display aspect ratio info from the container is more widely respected by video players than the same from the codec.

Alternatively, you can use "swsResize" video filter to rescale 720:576 anamorphic source to 1024x576 non-anamorphic (with square pixels) one which eliminates the need for specifying a display aspect ratio at the container level.

You might also need to re-encode the audio track as publicly broadcast MPEG-2 video streams are usually combined with either MP2 or AC3 audio tracks, not universally supported by video players on smartphones.
#8
Unix-Like (Linux/Bsd/...) / Problem with aspect ratio (L...
Last post by Seojeom - April 22, 2025, 03:31:48 PM
I am a first-time user — maybe that is why I'm having this problem. I recorded a short TS video file from digital TV that I want to share with some others with mobile phones. So I thought to use Avidemux to isolate the interesting part and to convert it to MP4 format (because that seems to be popular on phones.)

This succeeded, but the aspect ratio is a problem. The original video's aspect ratio is 16:9, as it is from a 16:9 TV. However, when Avidemux loads the file, it immediately changes (squeezes) it to 4:3, and this is kept in the output MP4 file. So the output is squeezed, in other words, useless.

As a new user, I'm at a loss. Looking at Output Format|Configure|Properties, it says "Image Size: 720x576" which seems to be wrong for a 16:9 image. On the other hand, "Aspect Ratio: PAL 16:9 (64:45)" which is wrong, too, as 16:9 is not equal to 64:45, and the output image's aspect ratio is, as noted above, 4:3 which is not equal either to 16:9 or 64:45.

I'm confused. Can anyone help? Thank you in advance!
#9
Windows / Re: Filter "image stabilizer"
Last post by MilosP008 - April 20, 2025, 07:29:52 AM
Quote from: szlldm on December 30, 2022, 01:16:37 PMSmoothing: filtering strength. higher value means more deshaking, but also more drift
Gravity: the amount of "force" that pulls back the drifted image to the center
The long bar, with the green(?) rectangle at the end creates the indicator for the scene change detector. The scene change detector threshold is set by the Scene threshold slider. The bar below that indicate the scene change detector output value. The green(?) rectangle at the end imitates an LED, so it flash when scene change detector output exceeds the threshold.
Should we exceed that threshold and can this filter be applied to cartoons when frames are moving because they originaly connected pictures that way. I am not sure if that is actual shakiness, but it looks like that.
#10
Main version 2.6 / Re: Navigating Segments in Tin...
Last post by tripunto - April 19, 2025, 08:40:15 PM
tanks eumagga0x2a

Thanks to your script, I've been able to perfect mine.

My script has several improvements that may be useful to other users.

1. It supports multiple files.
2. It automatically obtains video names and lists the cuts.
3. (Optional) You can define a unique name to list the cuts.


#PY  <- Needed to identify #
# Create by tripunto v0.1.3 (2025.04.19)

### Start new process
app=Avidemux(); ed=Editor(); gui=Gui(); app.clearSegments(); app.clearVideoFilters()

### Output file name and directory
out_folder = gui.dirSelect("Select the destination directory") # pop up a dialog asking for a destination directory
out_segment_name = "_cut"
out_ext = "mp4"
out_filename = "" # Edit to rename the cuts in the output files

### Replace lines 15 through 60 with the script from the saved project file.

#adm=Avidemux()
#if not adm.loadVideo("/path/to/file1.mp4"):
#    raise("Cannot load /path/to/file1.mp4")
#if not adm.loadVideo("/path/to/file2.mp4"):
#    raise("Cannot load /path/to/file2.mp4")
#if not adm.loadVideo("/path/to/file3.mp4"):
#    raise("Cannot load /path/to/file3.mp4")
#adm.clearSegments()
#adm.addSegment(1, 294583333, 69833333)
#adm.addSegment(0, 35166666, 14066667)
#adm.addSegment(0, 21100000, 14066666)
#adm.addSegment(1, 217375000, 77124999)
#adm.addSegment(2, 428957550, 54822222)
#adm.addSegment(2, 162024216, 38933334)
#adm.markerA = 175091665
#adm.markerB = 760580558
#adm.setHDRConfig(1, 1, 1, 1, 0)
#adm.videoCodec("x264", "useAdvancedConfiguration=True", "general.params=AQ=25", "general.threads=0", "general.preset=ultrafast", "general.tuning=none", "general.profile=baseline", "general.fast_decode=False", "general.zero_latency=False"
#, "general.fast_first_pass=True", "general.blueray_compatibility=False", "general.fake_interlaced=False", "level=-1", "vui.sar_height=1", "vui.sar_width=1", "vui.overscan=0", "vui.vidformat=5", "vui.fullrange=False"
#, "vui.colorprim=2", "vui.transfer=2", "vui.colmatrix=2", "vui.chroma_loc=0", "MaxRefFrames=3", "MinIdr=25", "MaxIdr=250", "i_scenecut_threshold=40", "intra_refresh=False", "MaxBFrame=3", "i_bframe_adaptive=1"
#, "i_bframe_bias=0", "i_bframe_pyramid=2", "b_deblocking_filter=True", "i_deblocking_filter_alphac0=0", "i_deblocking_filter_beta=0", "cabac=True", "interlaced=False", "constrained_intra=False", "tff=True"
#, "fake_interlaced=False", "analyze.b_8x8=True", "analyze.b_i4x4=True", "analyze.b_i8x8=True", "analyze.b_p8x8=True", "analyze.b_p16x16=False", "analyze.b_b16x16=False", "analyze.weighted_pred=2", "analyze.weighted_bipred=True"
#, "analyze.direct_mv_pred=1", "analyze.chroma_offset=0", "analyze.me_method=1", "analyze.me_range=16", "analyze.mv_range=-1", "analyze.mv_range_thread=-1", "analyze.subpel_refine=7", "analyze.chroma_me=True"
#, "analyze.mixed_references=True", "analyze.trellis=1", "analyze.psy_rd=1.000000", "analyze.psy_trellis=0.000000", "analyze.fast_pskip=True", "analyze.dct_decimate=True", "analyze.noise_reduction=0", "analyze.psy=True"
#, "analyze.intra_luma=11", "analyze.inter_luma=21", "ratecontrol.rc_method=0", "ratecontrol.qp_constant=0", "ratecontrol.qp_min=10", "ratecontrol.qp_max=51", "ratecontrol.qp_step=4", "ratecontrol.bitrate=0"
#, "ratecontrol.rate_tolerance=1.000000", "ratecontrol.vbv_max_bitrate=0", "ratecontrol.vbv_buffer_size=0", "ratecontrol.vbv_buffer_init=1", "ratecontrol.ip_factor=1.400000", "ratecontrol.pb_factor=1.300000"
#, "ratecontrol.aq_mode=1", "ratecontrol.aq_strength=1.000000", "ratecontrol.mb_tree=True", "ratecontrol.lookahead=40")
#adm.addVideoFilter("resampleFps", "mode=0", "newFpsDen=1000", "newFpsNum=25000", "interpolation=0")
#adm.addVideoFilter("crop", "top=0", "bottom=0", "left=32", "right=32", "ar_select=0")
#adm.addVideoFilter("swscale", "width=1280", "height=720", "algo=2", "sourceAR=0", "targetAR=0", "lockAR=True", "roundup=0")
#adm.audioClearTracks()
#adm.setSourceTrackLanguage(0,"und")
#if adm.audioTotalTracksCount() <= 0:
#    raise("Cannot add audio track 0, total tracks: " + str(adm.audioTotalTracksCount()))
#adm.audioAddTrack(0)
#adm.audioCodec(0, "LavAAC", "bitrate=96")
#adm.audioSetMixer(0, "MONO");
#adm.audioSetResample(0, 44100)
#adm.audioSetDrc2(0, 0, 1, 0.001, 0.2, 1, 2, -12)
#adm.audioSetEq(0, 0, 0, 0, 0, 880, 5000)
#adm.audioSetChannelGains(0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
#adm.audioSetChannelDelays(0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
#adm.audioSetChannelRemap(0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8)
#adm.audioSetShift(0, 0, 0)
#adm.audioSetNormalize2(0, 1, 10, 0)
#adm.setContainer("MP4", "muxerType=0", "optimize=1", "forceAspectRatio=False", "aspectRatio=1", "displayWidth=1280", "rotation=0", "clockfreq=0")

#####################################################################
### Start the process of splitting segments into individual files ###
#####################################################################

nbSeg = ed.nbSegments()
if not nbSeg:
    gui.displayError("Error", "No video loaded, nothing to do, bye")
    return

if nbSeg > 100:
    gui.displayInfo("Warning", "Maximum of 100 segments supported, but got " + str(nbSeg))
    nbSeg = 100

Counter = 0
mark2 = 0
video = {}

for i in range(nbSeg):
leadingZero = ""
file_name = ""
mark1 = mark2
file_id = ed.getRefIdxForSegment(i)
file_path = ed.getRefVideoName(file_id)

if file_path is None:
gui.displayError("Error", "Cannot obtain reference video file_path")
return

### Select auto 'file_name' from video file if 'out_filename' is not defined
if not out_filename:
file_name = (splitext(file_path))[0]
file_name = basename(file_name)
if file_name is None:
gui.displayError("Error", "Cannot obtain input basename, include the files and segments from saved project")
raise("ERROR: Cannot obtain input basename, include the files and segments from saved project")
return
if file_id not in video:
out_cut_number = 1
else:
out_cut_number = video[file_id]+1
video[file_id] = out_cut_number
if out_cut_number < 10:
leadingZero = "0"

### Select 'file_name' for 'out_filename' variable
else:
file_name = out_filename
out_cut_number = str(i+1)
if i < 10:
leadingZero = "0"

### Select segment to file cut process
mark2 += ed.getDurationForSegment(i)
print("Segment start:",mark1,"Segment end:",mark2)

app.markerA = mark1
app.markerB = mark2

### Save to individual file from segment marks
output_file = out_folder + "/" + file_name + out_segment_name + leadingZero + str(out_cut_number) + "." + out_ext
Counter += app.save(output_file)

gui.displayInfo("Finished", str(Counter) + " files out of " + str(nbSeg) + " segments converted")

I'd like to make some final adjustments so I don't have to edit the script again.

1. It defines the 'out_filename' variable using a text input window.
2. It imports the project file, but I'm getting errors with 'import gui.fileReadSelect("Select input file")'
.
It would be great if I could request that data from the script!