[WNYLUG-Users] vlc and subtitles

Joe josephj at main.nc.us
Sun Jul 24 20:20:55 EDT 2011


I have a few videos I want to play that are not in English.  I got the 
subtitle files from the net, placed the in the same directory as the 
video and named them identically (except one is .avi and the other is .srt).

When I play with kaffeine, it ignores the subtitles completely, so I 
switched to vlc.

vlc initially ignored the subtitles too until I went into 
Video->Subtitles-Track->Open File.

This is the first clue that things are amiss.  From what I understand, 
if vlc finds a video and subtitles with the same name, but the subtitles 
have the .srt extension, it should automatically display the subtitles 
if subtitle are enabled (which they are).

That worked and I also wrote a bash script to invoke vlc with the 
--sub-file argument and that worked too.

*But*, then I used vlc to play a video with no subtitles and it popped 
up a message about not being able to find the subtitles (for the 
previous video) - like it was remembering what it did last.

File reading failed:

VLC could not open the file "file.srt".

Your input can't be opened:

VLC is unable to open the MRL 'file.srt'. Check the log for details.

I replaced the actual file name with "file".

So, why does vlc think it needs subtitles (especially for the previous 
video, and not the current one)?

And, how to I properly re-educate it?

How do I turn this on and off?  Do I have to disable subtitles manually 
in Preferences?

TIA

Joe - kubuntu lucid x86

Further flailing:  Sorry this is so long, but I've been at it quite awhile.

I closed vlc andran
ps -ef | grep vlc
No instances of vlc were running.
I checked my aliases and .bashrc and they have nothing relevant (that I 
see).
I looked at $HOME/.vlc/vlcrc and it looks (AFAIK) like everything is 
commented out (starts with a #).

I also tried running vlc with the desktop run command and gave it my 
non-English video file.  It popped up the same error - possibly because 
it wasn't running from the directory the file and subtitles are in.

Then, I tried going to the directory of the non-English video in 
dolphin, right clicking on it, and selection open with vlc.  Even though 
the subtitle file is right there, I get the same error.  I get the same 
problem in konsole when I cd to the directory the video is in and type 
vlc file.avi   .

If I right click on the file and tell it to use my bash script to open 
it, it works fine with subtitles.

I also went back to another file (English with an unmatched name 
subtitle file) and directory and used open with vlc.  It opened and ran, 
but complained that it couldn't find the subtitle file from the 
non-English video - not the one that I was playing now.

It seems totally fixated on the last subtitle file it found regardless 
of what I am asking it to play now.

I just fixed the name of the subtitles for the English video and that 
did nothing until I explicitly used it in the --sub-file argument which 
worked.  I ran it again without the --sub-file and it went back to 
complaining about the non-English subtitles from the other video being 
missing.

I just uninstalled and reinstalled vlc.  Didn't help.

It says to check the log, but I can't find it.

I checked Tools->Messages and it's empty.
I went into View->Add Interface and selected Debug logging, but that 
didn't do anything either and doesn't seem to stick between invocations.
I created $HOME/temp/vlc.log, but can find no way to tell vlc about it.

Here's my script (just in case it does something unintentional.)

#!/bin/bash
## start vlc with subtitles
## Copyleft 07/24/2011 - JPmicrosyatems

## Usage is vlcsub <video-file> [<subtitle-file>]
## If second argument is missing use first argument with .srt

##shopt -s -o xtrace
##shopt -s -o verbose

NAME=$(basename $0) # path stripped name of this script
USAGE="Usage is: ${NAME} <video-file> [<subtitle-file>]"
ZOPT="--title $NAME"  # zenity common options
DSPTIME=60  ## zenity message timeout interval

function error() {
   echo ${USAGE}
   exit 1
}

## Must have one or two arguments
if (( $# < 1 )) || (( $# > 2 ))
then
   error
fi

## Video file must be readable
if [ ! -r "${1}" ]
then
   echo "${NAME}: [${1}] not readable"
   error
fi

## If subtitle file (arg 2) not specified, use the file name of the 
video with a .srt extension
if (( $# == 2 ))
then
   SUBTITLE="${2}"
else
   SUBTITLE="${1%.[!.]*}.srt"
fi

## Subtitle file must be readable, but, if it's not, complain and play 
it without subtitles
if [ ! -r "${SUBTITLE}" ]
then
   kstart --windowclass 'Plasma' --ontop zenity ${ZOPT} --info 
--text="${NAME}: Subtitles file [${SUBTITLE}] not readable" ### 
--timeout=${DSPTIME}
   ##sleep 5
   vlc "${1}" &
else
   vlc --sub-file "${SUBTITLE}" "${1}" &
fi

exit



More information about the Users mailing list