How to specify multiple images as source to signalstats filter with FFProbe? - ffprobe

The signalstats of a single image can be calculated via ffprobe with this command:
ffprobe -f lavfi -i "movie=0000002110.jpg,signalstats,metadata=print"
I'd like to do this in a folder with sequential file numbers. In ffmpeg I'm able to achieve this sort of input like this:
ffmpeg -start_number 1036 -i %010d.jpg -vf "crop=100:100:0:0" \cropped\%010d.jpg
The filter documentation for the movie parameter implies that if I might have the right format or stream specifier things might go better.
I am able to get ffmpeg to do it with a standard -i via:
ffmpeg -start_number 2110 -i %010d.jpg -vf signalstats,metadata=print -f null -
FFProbe would be better for my target environment.

This would be the syntax for reading an image sequence with ffprobe.
ffprobe -f lavfi -i "movie='%010d.jpg':f=image2:format_opts='start_number=2110',signalstats,metadata=print" -v 0 -show_entries frame_tags
The data will be printed to stdout.

Related

Tshark outputs json during live capture

i want to run tshark for a live capture of my internet traffic my goal is to save the captures in json files in a folder now i'm using :
tshark -P -i 4 -w outfile.pcap
The prolem with this cxommand is that the output file is one gigantic file that i can't use while tshark is running and it's not json .
The -T json option instructs tshark to output JSON:
tshark -T json -i 4 > outfile.json

How can I use ffmpeg to stream over http

I am using the follow commands to stream to my localhost
ffmpeg -i b.mp4 -r 60 -bufsize 1024k -vcode libtheora -qscale:v 1 -f ogg "udp://#127.0.0.1/video.ogg"
ffmpeg -i b.mp4 -r 60 -bufsize 1024k -vcode libtheora -qscale:v 1 -f ogg "http://127.0.0.1/video.ogg"
The both work very well, at least do not show any errors, but when I try play such http stream does not, it gave me error "not found"
Can somebody help me on it? I am complety lost in this issue...also when I try include some port, for example ffmpeg -i b.mp4 -r 60 -bufsize 1024k -vcode libtheora -qscale:v 1 -f ogg "http://127.0.0.1:8980/video.ogg" provide me input/output error...I have test the equivalent commands on vlc and is work as well.
Thanks in advance
The best way to put a video available on the web, is:
1 - Transcode the video with the ffmpeg. Recommended with h264, why? Only PC browsers (except Opera) support it, is much more efficient h264 or VP8 (livpx).
The call to ffmpeg should be:
 
h264
ffmpeg -i input -vcodec libx264 -acodec libfaac out.mp4
vp8
ffmpeg -i input -vcodec libvpx -acodec vorbis out.webm
Theora
ffmpeg -i input -acodec vorbis -vcodec libtheroa out.ogg
 
2 - Install a web server like Apache or Nginx Lighttpd
sudo apt-get install lighttpd
3 - Link www folder with the folder out with ffmpeg ln -ls
sudo ln -ls / var / www / / home / your_user / path_to_out_ffmpeg
Your method is wrong because when you have stopped ffmpeg your contents aren't avaliable. It method is only avaliable for live video.

Simple way to verify valid BPF filter

What is the simplest way to verify a BPF filter as a normal user?
Easiest I have found is to run tcpdump with a small pcap file as input to the -r option.
$ tcpdump -r one_packet.pcap -F invalid_bpf.conf 2> /dev/null ; echo $?
1
$ tcpdump -r one_packet.pcap -F valid_bpf.conf 2> /dev/null ; echo $?
0
Returns standard error codes for invalid or valid BPF filters. This requires that I have a PCAP file to provide as input.
Is there a way to do this simple test without a PCAP file or special privileges?
IF you have a shell that has a built-in "echo" command that supports escape sequences, one somewhat-perverse way of doing this would be to do
echo -en "\0324\0303\0262\0241\02\0\04\0\0\0\0\0\0\0\0\0\0377\0377\0\0\01\0\0\0"|\
./tcpdump -r - -F bpf.conf 2>/dev/null; echo $?
This worked for me on OS X 10.8, which has bash 3.2.48(1)-release (x86_64-apple-darwin12).
That "echo" command writes out a short pcap file with no packets in it, and with a link-layer header type of DLT_EN10MB. That will test whether the filter is valid for Ethernet; there are filters that are valid for some link-layer header types but not valid for others, such as "not broadcast", which is valid for Ethernet but not for PPP, so you'll need to choose some link-layer header type to use when testing.

How to use tcpdump to retrieve mcs index

I am trying to figure out how to use tcpdump to find the mcs index for packets. I have gotten as far as figuring out that I need to be extracting something from the radiotap header (I am on a mac so I should have access to this). I have gotten as far as:
tcpdump -i en1 -I -y ieee802_11_radio
I am also open to using something like tshark. With tshark I have gotten as far as:
tshark -i en1 -Y radiotap.mcs.index -I
I do not know where to go from here or if this might be giving me what I need without me knowing it. This might just be a question about deciphering the output, but I am not really sure. I have done a lot of searching but have not found a lot of explicit documentation.
Tcpdump doesn't currently extract the 11n or 11ac information from a radiotap header, so you can't get the MCS index with it. This is a bug; I'll fix it.
The TShark command you would want would be something such as
tshark -i en0 -I -Y radiotap.mcs.index -T fields -e radiotap.mcs.index
-Y radiotap.mcs.index means "discard packets that don't have radiotap.mcs.index"; -T fields -e radiotap.mcs.index means "print the value of radiotap.mcs.index if it's present in the packet" (it prints a blank line if it's not present in the packet, which is why you also use the -Y flag).

Converting a bash command output into JSON and serving it over http on the fly

I want to convert the output of ifstat command into JSON and serve it over http on the fly to be used for a javascript graph app. Are there any lightweight -- sed or awk -- command-line solutions which I can use? I do not want to store JSON output on the disk and it would be good if the web-server was a small lightweight command line tool into which I can pipe JSON output.
EDIT 1:
This is the live streaming chart library which will use the data. I'm not keen on a specific web server; any webserver that does the job would be fine.
This is what I have tried.
Terminal #1
ifstat -n | awk 'NR>2{print systime(),$0; fflush()}' | tee ifstat.log
Terminal #2
while :
do
{
echo -e "HTTP/1.1 200 OK"
echo -e "Content-Type: application/json\n"
tail -n1 ifstat.log | awk '{ printf("{\"time\":%s, \"in\":%s, \"out\":%s}\n", $1, $2, $3) }'
} | nc -l 8000
done
firefox
open: http://localhost:8000
{"time":1332052321, "in":1.24, "out":2.62}
I know little about JSON. Maybe the output is invalid. You should rewrite the awk command.