Friday, June 27, 2008

Using libx264 codec with ffmpeg

This is the information about the input file :

$ ./ffmpeg.exe -i input.avi

Duration: 01:47:20.81, start: 0.000000, bitrate: 909 kb/s
Stream #0.0: Video: mpeg4, yuv420p, 560x304 [PAR 1:1 DAR 35:19], 23.98 tb(r)

Stream #0.1: Audio: mp3, 48000 Hz, stereo, 32 kb/s

then
$./ffmpeg.exe -i input.avi -ss 0 -t 20 -vcodec libx264 out.mpg

then I tried to play out.mpg with VLC, but it only played the audio only.
Winamp, Windows Media player couldn't even play it.
Uploading to Youtube : Failed (invalid file format)
Used as a source file to a videoDisplay object in Adobe Flex,
: unable to play the file.
Uploading to Vimeo : There was a problem converting this video. Please contact vimeo help !

Thursday, June 26, 2008

Building ffmpeg with libx264/h.264/x264 on Cygwin(Wiindows XP)

I am assuming here that you already have a build setup for ffmpeg
under Cygwin and looking for how to add x264 codec to it.
If you are new to ffmpeg build under cygwin, you might want to check this.

Now, you need to do this :
1. Install git for cygwin
2. $ git clone git://git.videolan.org/x264.git

Go inside the x264 folder and
remove these from the file "configure" :
"-mno-cygwin" (source)

./configure
./make

In my case it complained that nasm is missing, so I
downloaded and installed it for cygwin.

It will generate x264.h and libx264.a, which you have
to copy to /usr/include/ and /user/lib/ respectively.

Then inside the ffmpeg source folder :
./configure --disable-static --enable-shared --enable-memalign-hack --enable-libx264 --enable-gpl

then
./make

and that should be it.

------------------------------------------------------------------------

PS : Earlier I downloaded the x264 source code from here :
ftp://ftp.videolan.org/pub/videolan/x264/snapshots/

As it turned out, the version that is here and the version
that was expected by ffmpeg source code was different,
since after building x264 when I tried to build ffmpeg, I got these errors :

libavcodec/libx264.c: In function `X264_init':
libavcodec/libx264.c:151: error: structure has no member named `i_rc_method'

After which I tried to fetch some older versions from the SVN repository,
but for some reason it asked my username and password :

svn merge -rHEAD:280 x264.h
Authentication realm: df754926-b1dd-0310-bc7b-ec298dee348c
password for 'LENOVO':

It was then that I switched to the git repository of VLC.







Wednesday, May 7, 2008

Strange flex behavior

I have this function in flex.
It works correctly as it is.
But if I interchange the lines highlighted in bold,
it stops working.
strange but true.


public function playInTheMainPanel(event:MouseEvent):void{
mainVideo.source = (VideoDisplay)((Canvas)(event.currentTarget).getChildAt(0)).source;
mainVideo.stop();
mainVideo.play();
}

Monday, April 7, 2008

ffmpeg with vhooks built under Windows ! Using Cygwin .

All the DLLs can be downloaded from here.(download watermark.dll for ffmpeg)

Ok, so I have been able to build ffmpeg with vhooks on Windows.
As I mentioned in my previous post, vhooks couldn't be built
with Mingw, I needed Cygwin.

Still I couldn't build imlib2.dll,
only null.dll, fish.dll and watermark.dll.

That means I can use only images as watermarks.

Ok now, to build it on Cygwin, you need to have certain cygwin packages.

ust install your Cygwin with all the "Base" packages, plus the following "Devel" ones:

binutils, gcc-core, make, subversion

Do not install binutils-20060709-1 (they are buggy on shared builds); use binutils-20050610-1 instead.

Source for this cygwin info.


Then get the latest svn snapshot from ffmpeg site, that means
the latest ffmpeg source code.

Unzip it, and go inside it using Cygwin prompt.
and type this :

$ ./configure --disable-static --enable-shared --enable-memalign-hack --enable-vhook

Now I got an error that I don't have cmp.exe.
So I searched and found the solution here.
Solution is that you have to install diffutils on cygwin.

then
$ make


Next, I got two errors :

1. rtsp.c:1097: error: 'EPROTONOSUPPORT' undeclared (first use in this function)

Solutions are here.

What I did was replaced EPROTONOSUPPORT in rtsp.c with AVERROR_NOTSUPP
and it worked.

2. version.h:2: error: missing terminating " character.
I looked up version.h, it had a strange ^M character in it, which
I deleted and again

$ make


$make install

After building vhooks, now I had problems with using the watermark.
You can find the discussion that ensued on Experts-exchange here.

Saturday, April 5, 2008

ffmpeg vhooks on Windows

To watermark one's videos, there is a library called
vhooks, which can be used with ffmpeg.

But I could not locate precompiled vhooks for windows
(vhooks.dll) on net, so I decided to build it.

So I built ffmpeg on Windows using Mingw and following
the step-by-step guide here.

There was one problem though. That problem and its
solutions are listed here.

But it turned out that vhooks can't be built using Mingw.

Some links suggested that it might be built using Cygwin.
So, will try that next.

True Google Rank

Download

What it does is this :

Give as inputs a keyword or keywords, and a domain name or a web page
and the range in google results to search for. It will tell you where does your page/domain
appear in the search results in the 100 results starting from that result number. For e.g. if your domain name www.example.com is the
fifth result on 2nd page of google results for keyword=example, and 3rd result
on 4th page, output would be :

Found at these ranks : 15 33

There are two ways to use it :

Browser :
open first.html
for multiple keywords, simply enter them separated by spaces.
no support for phrases yet.
enter a url and result range to search

Command line :
Usage :
php.exe true_google_rank.php <keyword> < url >
< start result num between 0 and 999> 

for e.g.
php.exe true_google_rank.php dogra wikipedia 10


multiple keywords need to be entered inside " and ".
no support for phrases yet.

You will need php.exe and php5ts.dll for that, bundled
with this zip file .(on linux, I haven't tried yet)




Download


Warning : If you use this script too often(may be 5-6 times a minute),
you might get the dreaded sorry.google.com page. Google decides what
is too often.

License : GPL.

If you like this, contribute by clicking on the Donate button below :










Blog Archive