Can this be done with using the free software (freebsd way).
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 said:I couldn't find the Ajax program to install either.
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.