Thread: Beginner Scripting Question- How to Wait When && Doesn't Work
solved! :d solution coming soon. paddy landau , carranty!
hi! i'm taking first leap scripting, , after pulling hair out hours , hopeless google searches, here am, sorry people :p
problem:
goal here create desktop recording script seemingly needless other things after has finished recording desktop. (with ffmpeg, can stop recording pressing ctrl+c in terminal)
problem i'm having can't figure out how script wait until recorder has finished recording progress onto next step. using && or ||, seems execute next line of code immediately. took @ trying figure out how make wait pid() things work, geez.. life of me can't figure out, or if right solution anyway.
if can me figure how on earth should approaching script make work way intended--- ----geez, way nice!
what intending script?
i'll break down script:
here, i'm calling terminal window ffmpeg desktop recording script. reason calling new terminal window because im not sure how stop recording without terminal (this scripts intended use 1 click button on .. desktop, let's say. seems work fine!code:lxterminal -e ffmpeg -f x11grab -s 1580x1050 -r 16 -i :0.0 -sameq /folder/video.mkv && mencoder /folder/video.mkv -o /folder/very-low-fps-version/video.mkv -ovc x264 -x264encopts
second part of script takes recorded video , makes low fps version of , puts in separate folder (for voluntary archival reasons if must know! :p)
, so.. mentioned, figuring out how make second part of script wait until recording has stopped has been.. tough! (the desktop recording terminal window closes following recording ceasing way). possible make command says essentally "when terminal closes, go next command?"
here complete script, in case recommendations break next renaming component script reason.
thanks considering out on this, hehe. hope karma gods give more marshmellows in lucky charmscode:lxterminal -e ffmpeg -f x11grab -s 1580x1050 -r 16 -i :0.0 -sameq /folder/video.mkv && mencoder /folder/video.mkv -o /folder/very-low-fps-version/video.mkv -ovc x264 -x264encopts subq=1:bframes=2:b_pyramid=normal:weight_b -ofps .15 -nosound && /folder/very-low-fps-version/videozee.mkv /folder/very-low-fps-version/new-fancy-name-with-the-date' '$(date +%y-%m-%d)' h'$(date +%hm%ms%s).mkv & mv -i /folder/video.mkv /folder/original-uncompressed-video-with-a-new-fancy-name-with-the-date' '$(date +%y-%m-%d)' h'$(date +%hm%ms%s).mkv
i've never tried recording desktop (or have ever used ffmpeg) can't aspect running 1 command after should simple. instance lets want open gedit (a graphical word processor) , want create new folder called 'test' - want folder created after gedit has closed (a crazy scenario know, solution should work to). open terminal type
this command opens gedit, @ point can type like, folder test has not yet been created. when close gedit, folder created.code:gedit ; mkdir ~/test
writing line
lxterminal -e gedit ; mkdir ~/test
, running same.
think replacing && semicolon ; here
lxterminal -e ffmpeg -f x11grab -s 1580x1050 -r 16 -i :0.0 -sameq /folder/video.mkv && mencoder /folder/video.mkv -o /folder/very-low-fps-version/video.mkv -ovc x264 -x264encopts
trick.
hope helps.
edit : also, script gets longer keeping on 1 line can make difficult edit, rather typing
lxterminal -e gedit ; mkdir ~/test
i create text file following text
#!/bin/bash
gedit
mkdir ~/test
2 codes entirely equivalent second allows break script make more readable (and comment it).
Forum The Ubuntu Forum Community Ubuntu Official Flavours Support General Help [SOLVED] Beginner Scripting Question- How to Wait When && Doesn't Work
Ubuntu
Comments
Post a Comment