need help with simple script please

Started by comet424, May 04, 2020, 01:28:09 PM

Previous topic - Next topic

comet424

hi I been trying to google for scripts etc.. 
I use  unraid to host my avidemux.
and I like to repair all my videos   if its avi moi mkv mp4 etc  and put it to a mkv  after its done importing and repairing the video and now to save it to a mkv file

and id like
/input <input video folder>
/output <output video folder>
File formats to scan for..  <scan everything>
output file  format  <mkv  since it seems to be better then any file format  better then avi moi mp4>

I cant make avidemux to run like handbrake it detects  new files  added  and starts running

also  id like it to scan sub directories and duplicate the subdirectories  in the output folder

is there a script already done that does this?

signy13

I am afraid this is not a job for Avidemux itself but for a script in you operation system (shell) which would do most of operations you need and run Avidemux. I am no expert in scripting so if I needed something like this on Ubuntu, my solution would be a bash script:
* started by cron once in a while,
* the script would search for all video files or for files not older than some time,
* if they were not converted already it would run avidemux, load the file, run a settings script and save the file into desired destination.
Testing subdirectories, creating new directories in destination etc. would be another part of script.
Generally speaking I would not call it a simple script. Creating similar script needs some time for writing, testing and improving. Most of this operations are not related to Avidemux - Avidemux would be just one step in the larger script. It depends on your system and its resources.

comet424

didnt realize you replied

oh ok well i use UNRAID as my operating system.. i was hoping somewhere here had a script that was pre done for unraid and  i could just load it and run it .. 
ya i no good at scripting
as i no good at it all  ya i can use the cron or just run it   its too bad the unraid avidemux
couldnt have paramaters like

avidemux -rc "*.*"  "\output\"

so the "r" be read all subdirectories
     the "c" create subdirectiories in  the  "output" folder
     the  "*.*"  read all video formats not just 1 type  and remux them all even the mkv

as i no good at it all

eumagga0x2a

To mirror directory structure without files, you can use the rsync solution from https://stackoverflow.com/questions/11946465/copy-a-directory-structure-with-file-names-without-content.

To create a list of files in the structure, use

find /path/to/top/directory -type f \( -iname \*.avi -o -iname \*.ts -o -iname \*.mp4 \) > /path/to/filelist.txt && touch /path/to/top/directory/stamp

To read filelist.txt line by line, use something like

while read -r line; do avidemux --load "$line" --output-format MKV --save /path/to/mirror/$(echo $line | sed 's/path\/to\/top\///').mkv --quit; done < /path/to/filelist.txt

The command is not perfect (and obviously untested) as it won't strip the old extension (.avi, ts or mp4) from the saved file, i.e. you'd get "video.avi.mkv".

Next time you create filelist.txt, add -newer /path/to/top/directory/stamp to the find command to search only for files modified after the previous run of find.

comet424

ah ok  so would you say its a pain in butt   and why does it do video.avi.mkv  ?   
is it better then to run a script in windows a batch file... as i did install it on windows too..

i guess there is no simple solution..  i dont even under stand the code you posted what each thing does  like  sed

would you happen to know for windows and is it any better?  or is it best to scrap searching  for avi moi etc
and just go from now on with mkv

eumagga0x2a

Quote from: comet424 on May 28, 2020, 12:28:23 AM
so would you say its a pain in butt

At least not trivial at my level of bash scripting ignorance.

Quoteand why does it do video.avi.mkv  ?

As the file path stored in $line includes the extension, it is our business to strip it and replace with "mkv". The rough outline of the procedure I described in my reply didn't take care of that. It simply appended ".mkv" to whatever the original filename had been.

Quoteis it better then to run a script in windows a batch file... as i did install it on windows too..

For cmd.exe scripting virtuosity please ask the user "dosdan", I was too lazy to learn it as I normally don't use Windows.

Quotei dont even under stand the code you posted what each thing does  like  sed

That part is very poor anyway as it would fail if spaces are present in the path or filename. The sed command was deleting "/path/to/top" from the path stored in $line, with slashes in the string escaped.

Quoteor is it best to scrap searching  for avi moi etc

Just curious: what does "moi" (also mentioned in the first post in this topic) stand for???

Quoteand just go from now on with mkv

I fear, I can't follow you.

comet424

ah ok ill give him a message  the dan guy..

as for the  from now on go with mkv..  i mean  is  is from here on out  i wont use any other format to record video.. dont use avi, moi, divx,mp4.  since  mkv is the best i been told..
so what i mean is if i record a avi  then i need to convert it as its junk... i been told.. thats what i mean  from here on out only use mkv

sorry my dislexia doesnt explain things better..

as for the moi..  thats the file format my JVC Camcorder from 2006 or so recorded in.. would record moi to the hard drive on the camera  buts always a pain as hits hit and miss for Windows Media Player would play it...  VLC seems to play anything