# I want to  build a chat/video web page or app.



## paulfrottawa (May 3, 2010)

Can this be done with using the free software (freebsd way).


----------



## kpedersen (May 3, 2010)

Hello,

A chat application is trivial, just learn some basic sys/sockets.

A video application is a little bit more complex, I do not know the state of web cam support in FreeBSD but I do not imagine it to be that great.

A web page will generally not support realtime streams like video so you might want to use technology such as a Java applet. Perhaps it can be done using some very cool AJAX but that is gonna be slightly more involved.

A web chat page is very easy though.

Good luck.


----------



## paulfrottawa (May 3, 2010)

I have an ircd accout with 350 MiB could I use that.

It was 5 bucks and I thought I needed it for a while. But I don't and I really don't want to waste the money.

PS: I'm studing python right now is that a good choice?

___________________________
AJAX
Is there an application for that in the ports.


----------



## sixtydoses (May 3, 2010)

net/nakenchat?


----------



## paulfrottawa (May 4, 2010)

Thanks 
I wonder if my web-space provider would install it, they did for mod_python. But I'm installing it now and reading up on it. thanks again.

Now do you know what apps in the ports I can use for java. I have bluefish installed but I don't think that's it. I couldn't find the Ajax program to install either.


----------



## ProFTP (May 4, 2010)

to (chat and video) || (chat or video)??

and what traffic?

video - on low-level programming to write a server... (possible in python)


I saw an example of how this can be done about:
(like this we can write)


```
1.  
   2. use IO::Socket::UNIX;
   3. use IO::File;
   4.  
   5. my $vbrate = 64;
   6.  
   7. my $mplayer = "mplayer";
   8. my $mencoder = "mencoder";
   9.  
  10. sub get_length {
  11.   my ($file) = @_;
  12.  
  13.   my $pipe = IO::File->new("$mplayer -vo null -ao null -identify -ss 100:00:00 $file 2>&1|");
  14.   while (<$pipe>) {
  15.     if (/^ID_LENGTH=([\d\.]+)/) {
  16.       return $1;
  17.     } elsif (/^V:\s*(\d+\.\d+)/) {
  18.       return $1;
  19.     }
  20.   }
  21.   undef;
  22. }
  23.  
  24.  
  25. my $listen_path = "/tmp/transcode_socket";
  26. unlink($listen_path);
  27.  
  28. my $listen = IO::Socket->new(Type => SOCK_STREAM,
  29.                  Local => $listen_path,
  30.                  Listen => 1,
  31.                  Domain => AF_UNIX
  32.                 );
  33.  
  34.  
  35. my $sock;
  36. while (($sock = $listen->accept)) {
  37.   my $buf = $sock->getline;
  38.   my ($ifile, $ofile) = split(/\s+/, $buf);
  39.  
  40.   my $pid = fork();
  41.   if ($pid == 0) {
  42.     my $len = get_length($ifile);
  43.     my $ss = 0;
  44.     if ($len) {
  45.       $ss = $len / 2;
  46.     }
  47. #    system("mplayer -ss $ss -vo jpeg -frames 1 $ifile >/dev/null 2>&1");
  48.     exec "mencoder -vf scale=320:240 -ofps 15 -o $ofile -of lavf 
-lavfopts i_certify_that_my_video_stream_does_not_use_b_frames -oac lavc 
-lavcopts acodec=mp3:abitrate=32 -srate 22050 -ovc lavc -lavcopts 
vcodec=flv:vbitrate=${vbrate}:mbd=2:mv0:trell:v4mv:cbp:last_pred=3:predia=2:
dia=2:vmax_b_frames=0:vb_strategy=1:precmp=2:cmp=2:subcmp=2:preme
=2:qns=2 
-lavcopts vpass=1 $ifile";
  49.   }
  50. }
  51.  
  52. exit (0);
  53.  
  54.  


.
```


----------



## paulfrottawa (May 5, 2010)

Thanks I continue with python and fall back to looking for an Ajax program some other time. 

That looks like it is a really good start giving me code.


----------



## expl (May 5, 2010)

paulfrottawa said:
			
		

> I couldn't find the Ajax program to install either.



Ajax stands for "asynchronous JavaScript and XML". So as you can see its not a language or a program, its rather a method or technique of web development.


----------



## roddierod (May 5, 2010)

paulfrottawa said:
			
		

> Thanks I continue with python and fall back to looking for an Ajax program some other time.
> 
> That looks like it is a really good start giving me code.



That code is perl not python.


----------



## ProFTP (May 6, 2010)

ajax chat:
http://blog.elfet.ru/jquery/php-ajax-chat/

1) WebSockets http://en.wikipedia.org/wiki/Web_Sockets
2) push server, long-pull, aka Comet


----------



## paulfrottawa (May 6, 2010)

http://blog.elfet.ru/jquery/php-ajax-chat/

The link is broken right now the server seems to be down.

thanks I found it on a google search
php-ajax-chat

https://blueimp.net/ajax/

________________________________________________
PS: The ajax chat doesn't have video

Here's a webpage with code for video in python
http://technobabbler.com/?p=22


----------

