News:

--

Main Menu

How to convert all files in a folder?

Started by Vendeur, June 06, 2016, 04:04:29 PM

Previous topic - Next topic

Vendeur

Hi,

I would like to convert about 250 video files (all episodes of TV Friends). At this moment I have to open every file, make changes and queue. After all I run jobs. But it takes a lot of time to open and queue each file.

Is there any option to apply changes to all folder or a big number of files?

mean

you can use a tinypy script, there is a topic about that somewhere


Jan Gruuthuse

Some info can be found here: Simple Command line usage with Tinpy Project, don't post in that posting, thank you!
If you have further questions, continue in this thread.

Vendeur

Thank you Jan!

So I need to edit Project saved before. I can do it. But what should I add in to this project to make Avidemux open file, and after converting, save it and open the second, third etc.. ?

Jan Gruuthuse

you don't add into project.
you use batch file in Windows or bourne shell in Linux

Vendeur

Ok, I'm not good in this, will make in my style I think, file after file :/

BTW, how stupid is this, that such a good soft with so many possibilitys have no few so simples commands... Can not understand that.

mean

Sample tinypy script, that will load all file in c:\tmp with .mp4 extension
in the convert function, put what you do usually and end it by
adm.save(filein+".converted")

# Loas all mp4 files in intputFolder ending with extention mp4
# ...
#
ext="mp4"
inputFolder="c:\\tmp\\"
#
def convert(filein):   
    if(0 == adm.loadVideo(filein)):
        ui.displayError("oops","cannot load "+filein)
        raise
    print("Done")
   
#
# Main
#
ui=Gui()
adm=Avidemux()
#
list=get_folder_content(inputFolder,ext)
if(list is None):
    raise
for i in list:
        convert(i)
print("Done")


mean


EEMcGee

Thank you for the work on updating the Wiki.  Would it be difficult to add a batch processing menu item into Avidemux where it would just ask for the folder and type of files,  output folder, and which project file you want to use for all of them?  This kind of functionality could be a huge time saver for users.  I currently do it through batch files I made with Windows and it works well.  I do batch indexing of TS files and Processing Mpeg2 AVI files into MP4 with custom settings.

Jan Gruuthuse

you could of course use different workfolders to process your videos and have a fluent workflow process.
Separate folder for
avi to mp4 conversion
indexing ts
please also check this: Custom Menu and Saved projects

EEMcGee

#10
I just throw the PY and batch file into the directory I want to process then run the .bat file and walk away.  After all the files have been converted, I come back, select all of the original video files and delete them.  I don't know much about linux as to same functionality as batch files.  For those who don't know much about using .bat files in Windows I thought adding that functionality inside of avidemux might be a great option.

Here is a link to the thread with some batch files in it for converting folders in windows with a .bat file if you want to try that.  It's down toward the end of the thread.
http://avidemux.org/smif/index.php/topic,16769.msg74856.html#msg74856


mean


Vendeur

That video is just great, thank's for sharing it!

Vendeur

I made a project, but it doesn't working. What am I doing wrong?


#
# Load all the files with .mkv extension in a selected directory, convert with x265 video codec at 2000cbr, aac 128kb audio codec + noise reduction

#
gui = Gui()
adm = Avidemux()
ext = "mkv"
#
def convert(filein):   

    if(0 == adm.loadVideo(filein)):
        ui.displayError("oops","cannot load "+filein)
        raise
   adm.videoCodec("x265", "useAdvancedConfiguration=True", "general.params=CBR=2000", "general.poolThreads=0", "general.frameThreads=0", "general.preset=ultrafast", "general.tuning=psnr", "general.profile=main", "level=-1", "vui.sar_height=1"
, "vui.sar_width=1", "MaxRefFrames=3", "MinIdr=25", "MaxIdr=250", "i_scenecut_threshold=40", "MaxBFrame=3", "i_bframe_adaptive=1", "i_bframe_bias=0", "i_bframe_pyramid=2", "b_deblocking_filter=True", "interlaced_mode=0"
, "constrained_intra=False", "lookahead=40", "weighted_pred=2", "weighted_bipred=True", "cb_chroma_offset=0", "cr_chroma_offset=0", "me_method=3", "me_range=16", "subpel_refine=5", "trellis=1", "psy_rd=1.000000"
, "fast_pskip=True", "dct_decimate=True", "noise_reduction=0", "noise_reduction_intra=0", "noise_reduction_inter=0", "ratecontrol.rc_method=0", "ratecontrol.qp_constant=0", "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=0", "ratecontrol.ip_factor=1.400000", "ratecontrol.pb_factor=1.300000"
, "ratecontrol.aq_mode=2", "ratecontrol.aq_strength=1.000000", "ratecontrol.cu_tree=True", "ratecontrol.strict_cbr=False")

adm.addVideoFilter("fluxsmooth", "temporal_threshold=7", "spatial_threshold=7")
adm.audioClearTracks()
adm.setSourceTrackLanguage(0,"unknown")
adm.audioAddTrack(0)
adm.audioCodec(0, "Faac", "bitrate=128");
adm.audioSetDrc(0, 0)
adm.audioSetShift(0, 0,0)
adm.setContainer("MKV", "forceDisplayWidth=False", "displayWidth=1280")
adm.save(filein + ".converted.mkv") # save the file
    print("Done")
 
#
# Main
#

inputFolder = gui.dirSelect("Select folder")
#
list=get_folder_content(inputFolder,ext)
if(list is None):
    raise
for i in list:
        convert(i)
print("Done")





Please help me.