Subtitles

Need help? Post your questions here.

Moderator: moderators

Subtitles

Postby b1ackjosh » Wed Jan 19, 2011 9:20 am

Hey everybody I'm new to SubSonic and I have a quick question about Subtitles streaming videos.
#1 Is it possible...

and Second I found a request for it in the new feature's section of the forum but it said the post was put up back in 09' which I thought was kind of odd.

Anyway thanks for your help in advance, and I apologize if this has been asked before I just couldn't find anything in the forum.
b1ackjosh
 
Posts: 16
Joined: Wed Jan 19, 2011 9:15 am

Postby b1ackjosh » Thu Jan 20, 2011 7:51 am

I apologize, I probably should have given more information.

I'm currently trying to play mkv files with separate srt files through subsonic. Is this possible without having to convert the files to an avi format?
b1ackjosh
 
Posts: 16
Joined: Wed Jan 19, 2011 9:15 am

Same question

Postby gornack » Sun Jan 30, 2011 1:21 pm

Hello everyone,

This is relevant to my interest, too.
I'd like to stream .mkv or .avi files with .srt subtitles files attached (i.e. same filename, different extension).

I would be very happy to be able to see the subtitles in the video stream !
gornack
 
Posts: 5
Joined: Sun Jan 30, 2011 1:16 pm

Postby b1ackjosh » Sun Jan 30, 2011 2:30 pm

after some research I found a jwplayer plugin called Captions:

http://www.longtailvideo.com/AddOns/get ... 84&vid=271

It looks simple enough to plug in to a page... problem is that I don't know how to code in java, so these files all look familiar to me... but not enough to make changes without potentially breaking everything lol. If anyone can think of a way to implement this i wanna hear about. :D
b1ackjosh
 
Posts: 16
Joined: Wed Jan 19, 2011 9:15 am

Postby b1ackjosh » Mon Jan 31, 2011 6:45 am

So I've got it working... but I still need a little help.

I found this file:

C:\subsonic\jetty\****\webapp\WEB-INF\jsp\videoPlayer.jsp

Inside is the var for "flashvars" which is the variable settings for jwplayer.

Code: Select all
            var flashvars = {
                id:"player1",
                skin:"<c:url value="/flash/whotube.zip"/>",
                plugins:"captions-2",
            "captions.back": true,
            "captions.file": "<c:url value=""/>",
            "captions.fontsize": "10",
                screencolor:"000000",
                controlbar:"over",
                autostart:"false",
                bufferlength:3,
                backcolor:"<spring:theme code="backgroundColor"/>",
                frontcolor:"<spring:theme code="textColor"/>",
                provider:"video"
            };


Using this and setting an absolute path for the .srt file i'm using to test works. But I want to be able to use it without having to edit the embed code every time.

So I'm wondering if anyone know's the variable that subsonic use's to find specific files to play. I'm thinking it may be possible to use that same variable to tell the captions plugin where the subtitle is located. Though I probably won't be able to use the same variable i'd like to at least be able to find an example of it and make an attempt to put it in to the embed code above. Any help is appreciated.

P.S. dear moderator(s) this probably classifies as a mod... please feel free to move it there if you wish.
b1ackjosh
 
Posts: 16
Joined: Wed Jan 19, 2011 9:15 am

Postby gornack » Wed Feb 02, 2011 2:51 pm

Hi b1ackjosh,

I've been testing your solution, and it has been working fine for me too.
It worked with a relative path (the root being "/var/subsonic/jetty/2078/webapp" on my box).

But I've not been able to make it work with an absolute local path (like "/home/username/mysubtitle.srt").
Were you able to do that ?

And like you, I'm also still looking for a solution to make it work with a variable file name...
gornack
 
Posts: 5
Joined: Sun Jan 30, 2011 1:16 pm

Postby b1ackjosh » Fri Feb 04, 2011 4:50 pm

Hey gornack,

Yeah but that videoPlayer.jsp file is only able to see back to this directory.

/var/subsonic/jetty/2078/webapp

So if you set up a static link it can only see that far back.

If you create a directory in there and put a .srt file, all you'll need to do is set up the "caption.file" link and you'll see it works...

Problem with that is... I kind of don't want my subtitles in that directory... it would probably be better if I could just have the subtitles in the same folder as the video I'm trying to watch, then set up some sort of variable to get the "captions.file" string to pick up files dynamically. But I just don't know enough about coding in java to set it right....

I'm glad somebody else is trying this though :)
b1ackjosh
 
Posts: 16
Joined: Wed Jan 19, 2011 9:15 am

Postby gornack » Tue Feb 08, 2011 3:38 pm

OK I'm exactly in the same situation as you are.
I'll try to be looking for a solution when I have a bit of spare time.
gornack
 
Posts: 5
Joined: Sun Jan 30, 2011 1:16 pm

Postby gornack » Tue Feb 08, 2011 8:00 pm

Also, when seeking the movie, the subtitle starts off at the begining.
Do you have the same behaviour ?
gornack
 
Posts: 5
Joined: Sun Jan 30, 2011 1:16 pm

Postby b1ackjosh » Wed Feb 09, 2011 12:57 am

Yes I also get this but it seems to be a limitation of the plugin.
b1ackjosh
 
Posts: 16
Joined: Wed Jan 19, 2011 9:15 am

Postby rumil » Wed Feb 09, 2011 9:55 pm

Hello guys,
I've made a quick and reeaally dirty patch to make subtitles work. It assumes subtitles are located in the same directory as the movie file and its name is the same as the movie file with but with srt extension.

The patch itself can be found here: http://dl.dropbox.com/u/6845714/subsonic-captions.diff

Since it modifies one java class I've made a war available here: http://dl.dropbox.com/u/6845714/subsonic.war

There still is the issue with seeking though...
In my spare time (if I have some ;-) ) I'll look into more proper solution.

As I've written, if someone wants working subtitles now - feel free to use the version I've provided, just remember it's more of a hack then a proper implementation.

EDIT:
Since it's my first post here: Sindre, Thank You for your fantastic work!! I've just found and set up Subsonic yesterday and I really love it!
rumil
 
Posts: 2
Joined: Wed Feb 09, 2011 9:40 pm

Postby b1ackjosh » Tue Feb 15, 2011 8:47 pm

sorry... I'm still a bit of a noob at this can you tell me where I need to put this war file? and how to run the .diff file on linux command line(or windows)?
b1ackjosh
 
Posts: 16
Joined: Wed Jan 19, 2011 9:15 am

Postby rumil » Wed Feb 16, 2011 7:33 pm

Basically war is a zip file with whole subsonic app. I saw you are running jetty, so in your case stopping jetty (stopping subsonic) and then extracting war into /var/subsonic/jetty/2078/webapp should do (I don't really remember how jetty manages its webapps, just be sure that the directory structure of your subsonic and files you extract from my war are the same)
rumil
 
Posts: 2
Joined: Wed Feb 09, 2011 9:40 pm

Postby badsanta » Fri Feb 18, 2011 12:54 pm

Hi i've been also working on the subtitles, i used the harcoding method, and i got it working now ...

But my hook is also really dirty :

    - I create a new subfolder name pipe on transcode folder.
    - In the transcode folder i put a perl script called perlhook.
    - in transcoding avi files step 1 i put this command line :
    Code: Select all
    perlhook %o %s %bk %w %h

[/code]

Perl Script :
Code: Select all

#!/usr/bin/perl -w
use strict;
use threads;
use Data::Dumper;

sub mythread($){
my $cmdline = shift;
open(STDERR, ">stderr.log" ) or die "cannot redirect stderr output in log file : $!\n";
#open F,">encoderlog.log";
#select F;
#print $cmdline;
system("$cmdline > encoder.log");
}


my $o = shift @ARGV;
my $file = shift @ARGV;
my $b = shift @ARGV;
my $width = shift @ARGV;
my $heigth = shift @ARGV;
$b=~s/k//;

system("killall -9 mencoder");


my $sub=$file;
$sub =~ s/\.avi/\.srt/;

my $pipename;
$pipename=sprintf("/var/subsonic/pipes/subpipe%4d",int(rand(10000)));
my $cmdline;


#print "mkfifo $pipename\n";

system("mkfifo $pipename");


#### HALF WORKING
$cmdline = "mencoder \"$file\" -of lavf -oac lavc -ovc lavc -lavcopts vcodec=h264:vbitrate=1000:mbd=2:cmp=2:subcmp=2:trell=yes:v4mv=yes:aic=2:vglobal= 1:aglobal=1:acodec=libmp3lame:abitrate=96  -srate 44100 -af lavcresample=44100 -forceidx -lavfopts format=flv -vf scale=$width:-3 -o $pipename";
####################

#### WORKING
$cmdline = "mencoder \"$file\" -of lavf -oac lavc -ovc lavc -lavcopts vcodec=flv:vbitrate=$b:acodec=libmp3lame:abitrate=96  -srate 44100 -af lavcresample=44100  -lavfopts format=flv -vf scale=$width:-3 -sub \"$sub\" -ffactor 10 -subfont-autoscale 3 -subfont-encoding unicode -subcp latin1 -subpos 95 -vf expand=0:-120:-1:-1 -o $pipename";
########################

my $thread1 = threads->new(\&mythread,$cmdline);

#print $cmdline."\n";
open F,">/var/subsonic/test.txt";
print F "perlhook $o $file $b $width $heigth\n";
print F $cmdline;
close F;

sleep(1);

#ffmpeg -ss %o -i %s -async 1 -b %bk -s %wx%h -ar 44100 -ac 2 -v 0 -f flv -

#print "Starting cat on $pipename";

open F,"<$pipename";

system("cat $pipename");
system("rm $pipename");



As you see it makes work mencoder with subsonic, all the success resides in making stdout and stderr not poluting output videos.

Another thing the subtitles options are set for me (french subtitles) it may not working with others languages.

Bye !
badsanta
 
Posts: 3
Joined: Fri Feb 18, 2011 10:30 am

Postby lotherius » Tue Feb 22, 2011 3:24 am

So..... the short answer is... NO subtitle support at this time. Unless you're a programmer and willing to do it yourself.

This needs to be a high priority!

EDIT:
Hmm, and apparently the subtitles I'm not seeing are of a different sort than what's discussed here. Not getting subtitles from MKV files. Wonder if there's a fix for this?
lotherius
 
Posts: 2
Joined: Tue Feb 22, 2011 3:20 am

Next

Return to Help

Who is online

Users browsing this forum: No registered users and 12 guests