News:

--

Main Menu

2.7 BatchConverting with .py and ssa / srt

Started by schubi, December 16, 2017, 11:58:26 AM

Previous topic - Next topic

schubi

Hi folks,
I already searched this forum and the Internet to find an answer to my question... found nothing.

I want to convert a number of videos including their subs (srt) from mkv to avi.

When I work in batch style and I prepared the process by generating a Tinpy file (Avidemux-> Save project) by a single video
I am faced by the problem that the related line within the my.py file is corresponding on the example video where I generated
the my.py with.

#PY  <- Needed to identify #
#--automatically built--

adm = Avidemux()
adm.loadVideo("D:/Videos/myVideo_1of20_subbed.mkv")
adm.clearSegments()
adm.addSegment(0, 0, 2648730620)
adm.markerA = 0
adm.markerB = 2648730620
adm.videoCodec("xvid4", "params=2PASSBITRATE=2000", "profile=244", "rdMode=3", "motionEstimation=3", "cqmMode=0", "arMode=1", "maxBFrame=2", "maxKeyFrameInterval=250", "nbThreads=99", "qMin=1", "qMax=25", "rdOnBFrame=True"
, "hqAcPred=True", "optimizeChrome=True", "trellis=True", "useXvidFCC=True")
adm.addVideoFilter("swscale", "width=720", "height=404", "algo=2", "sourceAR=1", "targetAR=1")
adm.addVideoFilter("ssa", "font_scale=1.000000", "line_spacing=0.100000", "subtitleFile=D:/Videos/myVideo_1of20_subbed.ssa", "fontDirectory=c:", "extractEmbeddedFonts=1", "topMargin=0", "bottomMargin=0"
)
adm.audioClearTracks()
adm.setSourceTrackLanguage(0,"und")
adm.audioAddTrack(0)
adm.audioCodec(0, "copy");
adm.audioSetDrc(0, 0)
adm.audioSetShift(0, 0,0)
adm.setContainer("AVI", "odmlType=2")

So, how to solve this?
Shall I just copy these lines for my 20 Videos ;-) (deleting the markers ?) and adapt the corresponding lines or is there some more
elegant solution?

(And how to tell the system to convert the srt file to ssa?)

I think, this problem should arise not only for me...
Maybe you can help.

Best regards
schubi

Jan Gruuthuse

#1
This should be removed from tinypy script (tinypy.py )
adm.loadVideo("D:/Videos/myVideo_1of20_subbed.mkv")
adm.clearSegments()
adm.addSegment(0, 0, 2648730620)
adm.markerA = 0
adm.markerB = 2648730620


if you're on windows, then with something along the lines of:
for %%f in (*.mkv) do %avidemux% --load "%%f" --run tinypy.py --save %%%~nf.avi" --quit

and test if project file takes: "subtitleFile=%%~nf.srt"

only have the 20 .mkv and their 20 .srt in the subdirectory you want to process. could be you need some more testing
check if the variables are transferred, eventually use
echo %%f %%%~nf.avi %%%~nf.srt

schubi

Hi Jan,

Thanks for your quick response!
Will try that within the next days and keep you update about the results...

;)
schubi