which commands line are used to take a screenshot on android device (except screencap) - screenshot

I want to take a screenshot of my rooted samsung device using command line.
I have a constraint of time, I shouldn't exceed 2 s.
So my question is how can i take a screenshot using command line.

The following commands can be used to take a screenshot.
adb shell /system/bin/screencap -p /sdcard/screenshot.png
adb pull /sdcard/screenshot.png screenshot.png
Source
Update: After some research I've noticed a similar question that has an answer that might help you:
If the slow part is raw to png conversion (time adb shell screencap -p /sdcard/x.png is considerably slower than time adb shell screencap /sdcard/nonpng.raw, as I have it in games)
This shell script by max_plenert is a better example:
adb shell screencap /sdcard/mytmp/rock.raw
adb pull /sdcard/mytmp/rock.raw
adb shell rm /sdcard/mytmp/rock.raw
// remove the header
tail -c +13 rock.raw > rock.rgba
// extract width height and pixelformat:
hexdump -e '/4 "%d"' -s 0 -n 4 rock.raw
hexdump -e '/4 "%d"' -s 4 -n 4 rock.raw
hexdump -e '/4 "%d"' -s 8 -n 4 rock.raw
convert -size 480x800 -depth 8 rock.rgba rock.png
Source

Related

ffmpeg image sequence specify input framerate

I am trying to set the input framerate of a sequence of images (many folders):
if I am working with a single image sequence everything works properly:
ffmpeg -framerate 30 -i folder01/img%05d.jpeg -filter:v "crop=640:360" -r 30 outfilm.mp4
then, because I have more folders (and I was unable to get the -i concat:filesequence1|filesequence2 working) I tried to use:
ffmpeg -framerate 30 -f concat -safe 0 -i filelist.txt -filter:v "crop=640:360" -r 30 outfilm.mp4
but I receive an error:
Option framerate not found.
then if I omit the -framerate 30, everything runs smoothly, but ffmpeg defaults to a 25 fps value for the input image sequences.
Any ideas on how to fix this?
Use
ffmpeg -f concat -safe 0 -r 30 -i filelist.txt -filter:v "crop=640:360" -r 30 outfilm.mp4
When -r is used as an input option, it generates new timestamps at the given rate and sets that as the input framerate.

resize one video in 2 sizes in single command

When user uploads video then I make its 2 sizes. Earlier, I was doing this in two steps like following
First Size:
ffmpeg -i in.mp4 -filter:v "scale=iw*min(1170/iw\,300/ih):ih*min(1170/iw\,300/ih), pad=1170:300:(1170-iw*min(1170/iw\,300/ih))/2:(300-ih*min(1170/iw\,300/ih))/2" out.mp4
Second Size:
ffmpeg -i in.mp4 -filter:v "scale=iw*min(365/iw\,172/ih):ih*min(365/iw\,172/ih), pad=365:172:(365-iw*min(365/iw\,172/ih))/2:(172-ih*min(365/iw\,172/ih))/2" out1.mp4
But now to reduce processing time, I want to combine these 2 steps in one. I have read https://trac.ffmpeg.org/wiki/Creating%20multiple%20outputs and make following command
ffmpeg -i in.mp4 -filter:v "scale=iw*min(1170/iw\,300/ih):ih*min(1170/iw\,300/ih), pad=1170:300:(1170-iw*min(1170/iw\,300/ih))/2:(300-ih*min(1170/iw\,300/ih))/2" bigVideo.mp4 \ -filter:v "scale=iw*min(365/iw\,172/ih):ih*min(365/iw\,172/ih), pad=365:172:(365-iw*min(365/iw\,172/ih))/2:(172-ih*min(365/iw\,172/ih))/2" smallVideo.mp4
But it is giving following error
[NULL # 0xaee5440] Unable to find a suitable output format for ' -filter:v'
-filter:v: Invalid argument
so can anyone suggest me how i can solve it?
I tried to run both commands using the following script:
#!/bin/bash
for cmd in "$#"; do {
echo "Process \"$cmd\" started";
$cmd & pid=$!
PID_LIST+=" $pid";
} done
trap "kill $PID_LIST" SIGINT
echo "Parallel processes have started";
wait $PID_LIST
echo
echo "All processes have completed";
You can save it as filename.sh and make executable. after that you need to pass two of more commands as arguments, for example I ran as:
./filename.sh "ffmpeg -i input.mp4 -s 720x480 output1.mp4" "ffmpeg -i input.mp4 -s 1170x480 output2.mp4"
Your command was bit complicated for me so I try to run simple commands using parallel script.

How to capture screen and audio input and push to rtmp server?

I use avconv on ubuntu,I found this command
avconv -f alsa -i pulse -f x11grab -r 25 -s 1280x720 -i :0.0+0,0 -acodec libfaac -vcodec libx264 -pre:0 lossless_ultrafast -threads 0 video.mkv
to save as a file, and this command
avconv -i ./test.m4v -re -c copy -f flv "rtmp://localhost/livestream"
to push live stream.
How can I combine them together?
Firstly, you should ask such questions on video.stackexchange.com and not here.
Secondly, let's take apart the two commands that you have found:
-f alsa - format for the input is alsa
-i pulse - you are reading pulse (the pulseaudio driver)
-f x11grab - planning to read from the screen on x11
-r 25 -s 1280x720 - rate and size of the incoming video stream
-i :0.0+0,0 - this selects where the incoming video comes from
-acodec libfaac - here the output options start, you're setting audio code to libfaac, or at least trying to... since this option has been deprecated long time ago, currently -c:a would be used
-vcodec libx264 - setting video code, except that you should be using -c:v
-pre:0 lossless_ultrafast -threads 0 - some sort of parameters about how encoding should be done
video.mkv - this is the output file
And the second one
-i ./test.m4v - the file you're reading
-re - "Read input at native frame rate"
-c copy - do not reencode, but simply pipe as is
-f flv - the container format
"rtmp://localhost/livestream" - where you're planning to write all that.
When you understand that, it should be clear that what you are planning to do is to use the input and encoding part from the first command, and the format and output from the second one.
Here i didn't have time to check that everything that you found is working, you should do that yourself.

Run RapSearch-Program with Torque PBS and qsub

My problem is that I have a cluster-server with Torque PBS and want to use it to run a sequence-comparison with the program rapsearch.
The normal RapSearch command is:
./rapsearch -q protein.fasta -d database -o output -e 0.001 -v 10 -x t -z 32
Now I want to run it with 2 nodes on the cluster-server.
I've tried with: echo "./rapsearch -q protein.fasta -d database -o output -e 0.001 -v 10 -x t -z 32" | qsub -l nodes=2 but nothing happened.
Do you have any suggestions? Where I'm wrong? Help please.
Standard output (and error output) files are placed in your home directory by default; take a look. You are looking for a file named STDIN.e[numbers], it will contain the error message.
However, I see that you're using ./rapsearch but are not really being explicit about what directory you're in. Your problem is therefore probably a matter of changing directory into the directory that you submitted from. When your terminal is in the directory of the rapsearch executable, try echo "cd \$PBS_O_WORKDIR && ./rapsearch [arguments]" | qsub [arguments] to submit your job to the cluster.
Other tips:
You could add rapsearch to your path if you use it often. Then you can use it like a regular command anywhere. It's a matter of adding the line export PATH=/full/path/to/rapsearch/bin:$PATH to your .bashrc file.
Create a submission script for use with qsub. Here is a good example.

How do I start ssh command en subsequently a local command in a script?

I often at home on the 2nd floor and I keep an eye on the (open) groundfloor gardendoors by webcam and these scripts.
First I connect to the remote system with $sh ~/.camconn which contains:
sshpass -f 'passw' ssh -X name#remoteip '~/webcam5050'
the remote file ~/webcam5050 contains:
#! /bin/sh
cvlc -vvv v4l2:// --sout '#transcode{vcodec=mjpg,vb=2000,width=320,height=240,venc=ffmpeg}:duplicate{dst=standard{access=http,mux=mpjpeg,dst=0.0.0.0:5050/video.mpjpeg}
After a 5 to 6 seconds wait, I start the local webcam viewer $sh ~/compaqcam, containing.:
cvlc http://remoteip:5050/video.mpjpeg
and bingo: I get a nice VLC window on the desktop.
Of course I would like this all to happen with one command and I tried without avail:
#!/bin/bash
(camcon &) && (sleep 8 &) && (compaqcam &) &
A tiny bit of succes with I had with this script:
#!/bin/bash
(sshpass -f 'passw' ssh -X name#remoteip '~/webcam5050'&) && (sleep 8 &) && (cvlc http://remoteip:5050/video.mpjpeg &) &
which at least does show "sshd (accepted)" on the remote, but then nothing further happens.
Can one point me in the right direction?
If so I would be very(!) gratefull since my bash manuals (4pcs) failed me in this case.
I don't have your setup but I suspect the issue is the & after the sleep, which is going to put it into the background so it'll complete immediately, I think your script can just be:
#!/bin/bash
camcon &
sleep 8
compaqcam &
You could still do it on one line without the & after your sleep 8 but this way is clearer and easier to edit in the future.
!/bin/bash
camcon &
sleep 8
compaqcam &
did the trick, along with ssh-keygen and ssh-copy-id.
Thanks a lot!