midentify – mplayer

midentify – It is the utility come with mplayer to find video ID of video files….

# /usr/bin/midentify video.mp4
ID_VIDEO_ID=0
ID_AUDIO_ID=1
ID_AID_1_LANG=eng
ID_FILENAME=video.mp4
ID_DEMUXER=lavfpref
ID_VIDEO_FORMAT=avc1
ID_VIDEO_BITRATE=0
ID_VIDEO_WIDTH=320
ID_VIDEO_HEIGHT=240
ID_VIDEO_FPS=25.000
ID_VIDEO_ASPECT=1.3333
ID_AUDIO_FORMAT=255
ID_AUDIO_BITRATE=0
ID_AUDIO_RATE=24000
ID_AUDIO_NCH=2
ID_LENGTH=72.62
ID_SEEKABLE=1
ID_CHAPTERS=0
ID_VIDEO_CODEC=ffh264
ID_AUDIO_BITRATE=128000
ID_AUDIO_RATE=48000
ID_AUDIO_NCH=2
ID_AUDIO_CODEC=faad
ID_EXIT=EOF

Try # mediainfo to get video infrmation on linux box  🙂

Traffic Capture – tcpdump

Packet Sniffer

[root@svnlabs ~]# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.0     *               255.255.255.0   U     1      0        0 eth0
default         ip12.mshome.n 0.0.0.0         UG    0      0        0 eth0

# /sbin/route -n

# tcpdump -i eth0 ‘port 80’

# tcpdump -n -c 30000 -w /root/port.80.debug.txt

# tcpdump -X -vv -r /root/port.80.debug.txt

# tcpdump port http -w /home/s.txt (port 80)

Source:
http://www.ntop.org/download.html
http://linux.die.net/man/8/ifconfig
http://en.pudn.com/sourcecode/hack/sniffer/download61.html
http://www.cyberciti.biz/faq/tcpdump-capture-record-protocols-port/
http://openmaniak.com/tcpdump.php#tcp_use# netstat -n

file format validation

Below is the code to check file type in javascript..

<script type=”text/javascript” language=”javascript”>

function isImage(file) {
var image    = /\.(jpg|jpeg|bmp|gif|png|jpe)$/i;
if (image.test(file))
return true;
else
return false;
}

function isAudio(file) {
var audio    = /\.(mp3|wav|mid|midi|mp2|ul|ra|m3u|ram|rm)$/i;
if (audio.test(file))
return true;
else
return false;
}

function isArchive(file) {
var archive    = /\.(zip|rar)$/i;
if (archive.test(file))
return true;
else
return false;
}

function isVideo(file) {
var video = /\.(mov|mpg|mpeg|avi|asf|wmv|mpe|3gp|swf)$/i;
if (video.test(file))
return true;
else
return false;
}

</script>

If you really want to validate uploaded file… you have to use “Mediainfo” on linux to check/validate file mime type.

MediaInfo provides technical and tag information about a video or audio file.

# mediainfo --help

Features/Download: http://mediainfo.sourceforge.net/en/Download

Mediainfo: http://mediainfo.sourceforge.net/en

wget – server to server files transfer

wget is powerful utility in linux. We can use “wget” to download files of any folder on any server to our server.

wget will download files on local server in current folder, we can use

# pwd (for current directory)

# wget -H -r –level=1 -k -p http://www.domain.com/folder/

here level is folder’s level

Keep downloading files 🙂

HTMLDOC – html2image

htmldoc is a powerful simple-to-use tool/utility, which converts HTML to Postscript, PDF or indexed HTML output.

# convert /var/www/html/html2img/grid.ps -crop 280×300+40+9 -modulate 100 -geometry 530×480 /var/www/html/html2img/grid.png

here convert is ImageMagick tool for manipulating images..

pdftohtml

pdftohtml converters  PDF documents into HTML format, which is more suitable for Internet publishing. The converter produces HTML documents with texts, pictures, graphics and bookmarks.

pdftohtml software does not require Adobe Acrobat, or even Acrobat Reader.

Install pdftohtml on Fedora/Linux:

# yum install pdftohtml
# which pdftohtml

Usage: pdftohtml [Option] <PDF File> [<HTM File>]

Source: http://www.verypdf.com/pdf2htm/help/help.html

pdftk – fedora – merge pdf files

Pdftk allows to manipulate PDF easily and freely. It does not require Acrobat, and it runs on Windows, Linux, Mac OS X, FreeBSD and Solaris etc.

Features:

  • Merge PDF Documents
  • Split PDF Pages into a New Document
  • Rotate PDF Pages or Documents
  • Decrypt Input as Necessary (Password Required)
  • Encrypt Output as Desired
  • Fill PDF Forms with FDF Data or XFDF Data and/or Flatten Forms
  • Apply a Background Watermark or a Foreground Stamp
  • Report on PDF Metrics such as Metadata, Bookmarks, and Page Labels
  • Update PDF Metadata
  • Attach Files to PDF Pages or the PDF Document
  • Unpack PDF Attachments
  • Burst a PDF Document into Single Pages
  • Uncompress and Re-Compress Page Streams
  • Repair Corrupted PDF (Where Possible)

Install pdftk on fedora/linux:

# yum install pdftk
# which pdftk

Merge Two or More PDFs into a New Document
# pdftk 1.pdf 2.pdf 3.pdf cat output 123.pdf
Source: http://www.accesspdf.com/pdftk/

Resume Builder pdf2txt, word2txt

Reading PDF Files

XPDF package includes “pdftotext.” You have to install XPDF/pdftotext then run the following PHP statement to get the PDF text:

$txtcontent = exec('/usr/local/bin/pdftotext svnlabs.pdf -');

Reading DOC Files

This package is called Antiword. Here’s the PHP code to grab the Word DOC content:

$txtcontent = exec('/usr/local/bin/antiword svnlabs.doc');