A suggestion: Add an option to disable teletext subtitling

Feature requests for VLC.
imhere
New Cone
New Cone
Posts: 8
Joined: 13 Sep 2009 10:42
VLC version: 2.2.2
Operating System: Kubuntu 16.04
Location: Helsinki, Finland

A suggestion: Add an option to disable teletext subtitling

Postby imhere » 13 Sep 2009 11:05

Why? Because it sometimes clashes with DVB subtitling.

I'm playing back DVB TS files, usually including DVB subtitles. In order to enable the correct language subtitles automatically when present, I've defined a language in the 'Preferred subtitles language' window, in my case 'fi' for Finnish. This works fine when a subtitle stream is indeed present, but when one isn't found, there's a painful six second wait before the playback starts. A message
main warning: no vout found, dropping subpicture
main warning: can't get output subpicture
zvbi warning: can't get spu buffer
is outputted to the log when this happens. If I remove the language setting, playback always starts pretty much instantly.

Now, after some investigation, it seems that this delay happened because VLC chose the teletext stream to be displayed in absence of a DVB subtitle track. This is of course a false assumption: just because a transport stream advertises the presence of a teletext stream of a certain language this doesn't imply the presence of TTX subtitles. Even then, that wouldn't necessary be the preferred subtitle track. I've also got a clip from a Norwegian DVB transmission, revealing an another aspect of the same problem: If a teletext stream of a certain language is displayed first in the subtitle list, it gets chosen whenever that language is defined as the sub language, even if DVB subtitles of the same language would also be present lower in the list. However, there doesn't currently seem to be a way to differentiate between DVB and TTX.

This bug was not present in the 0.8.6h version of VLC. It's quite obvious why: it didn't identify the teletext stream language.

P.S.
An ability to disable unused options might be useful in other places as well.
I only ever use two deinterlacing options: 'blend' and 'linear'. Who uses 'discard'? Nevertheless, this gets chosen when I press button 'd'.

VLC_help
Mega Cone Master
Mega Cone Master
Posts: 25661
Joined: 13 Sep 2006 14:16

Re: A suggestion: Add an option to disable teletext subtitling

Postby VLC_help » 14 Sep 2009 10:36

I only ever use two deinterlacing options: 'blend' and 'linear'. Who uses 'discard'? Nevertheless, this gets chosen when I press button 'd'.
You can build VLC with only certain Deinterlace methods if you don't want the rest.

imhere
New Cone
New Cone
Posts: 8
Joined: 13 Sep 2009 10:42
VLC version: 2.2.2
Operating System: Kubuntu 16.04
Location: Helsinki, Finland

Re: A suggestion: Add an option to disable teletext subtitling

Postby imhere » 03 Feb 2010 22:25

You can build VLC with only certain Deinterlace methods if you don't want the rest.
It really seems compile-it-yourself is the only way to get things done. Since this reply, I've found a couple of other messages about what is essentially the same problem:

viewtopic.php?f=14&t=55181&p=202365
http://trac.videolan.org/vlc/ticket/2451

I've been putting this off, since although VLC is one of my favourite video players, I don't like to compile my own version of if any more than I want to compile my own version of OpenOffice: It takes time to set things up, more time to figure out what needs to be changed, even more time to compile, recompilation when there's a version update and ultimately the benefits are small. In other words, a fix perfectly suited for the regular codebase maintainers. However, since nothing has happened and I'm tired of wading through multiple sub-menus every other time I play something, it seems there's no other choice.

As expected, setting up a compile environment for a complex project like this always has issues. If users are expected to do this kind of thing in a regular basis, there should be clear, up-to-date, step-by-step instructions for setting up the environment. As it is, the instructions have too many choices that require background knowledge and too many vague spots.

I've documented the process here, in case someone needs to do the same.

----------------------------------------------------
Issues encountered are marked in red.

The goaI was to cross-compile for Windows using Ubuntu 9.10 x86. The installation used was updated from 9.04 (due to the mingw32-runtime >= 3.15 requirement for FFmpeg) and had a few extra packages installed, but hopefully the following will work as-is for a clean install as well.

The guide http://wiki.videolan.org/Win32Compile was used as a basis.

After installing Ubuntu, first we need the build tools:

sudo apt-get install mingw32 mingw32-binutils

Here are the rest of the packages I eventually found are needed, so one might as well install them now:

sudo apt-get install autoconf libtool libgcrypt11-dev
sudo apt-get install gettext cvs tofrodos


Next we download the source from http://www.videolan.org/vlc/download-sources.html :

vlc-1.0.5.tar.bz2

Then we check which version of MinGW is installed:

i586-mingw32msvc-gcc --ver

In my case, this returned "gcc version 4.2.1-sjlj (mingw32-2)". From http://people.videolan.org/~jb/Contribs/ we now choose and download a file that matches that one:

contrib-20091208-win32-bin-gcc-4.2.1-sjlj-runtime-3.15.2-only.tar.bz2

We need to make a new directory for the project. Since we're cross compiling we might as well be put everything under one directory (in this case, under 'home') so as not to affect the rest of the system.

sudo mkdir /home/vlc
sudo chown $(whoami):$(whoami) /home/vlc


First we extract the pre-built libraries. These are contained under directory path 'usr/win32/' and we strip the unnecessary 'usr'-part:

tar jxf contrib-20091208-win32-bin-gcc-4.2.1-sjlj-runtime-3.15.2-only.tar.bz2 -C /home/vlc --strip 1

Here we set the base directory location to where we extracted the files and modify some paths accordingly. Modification only needs to be done once, but exported variables are only valid per shell session, i.e. only in the same tab until it's closed. Btw, the 'export' keyword was missing from the script in the original guide, which caused some head-scratching later on:

export CONTRIBS=/home/vlc/win32
for file in $CONTRIBS/bin/*-config $CONTRIBS/lib/*.la ; do perl -i.bak -p -e 's|/usr/win32|$ENV{"CONTRIBS"}|g' $file ; done


Afterwards, I found the replacement was incomplete and by doing a search (grep /usr/win32 * -R -l | less)
the rest of the files that need to be modified were found:

for file in $CONTRIBS/bin/autopoint $CONTRIBS/bin/gettextize $CONTRIBS/lib/pkgconfig/*.pc ; do perl -i.bak -p -e 's|/usr/win32|$ENV{"CONTRIBS"}|g' $file ; done

Now we extract the source, contained under directory path 'vlc-1.0.5/' which will be stripped:

tar jxf vlc-1.0.5.tar.bz2 -C $CONTRIBS --strip 1

After this we get into the source directory:

cd $CONTRIBS

First we run bootstrap and set the variables:

./bootstrap

export PKG_CONFIG_LIBDIR=$CONTRIBS/lib/pkgconfig PKG_CONFIG_PATH=$CONTRIBS/lib/pkgconfig \
CPPFLAGS="-I$CONTRIBS/include -I$CONTRIBS/include/ebml" CXXCPP=i586-mingw32msvc-cpp \
LDFLAGS=-L$CONTRIBS/lib CC=i586-mingw32msvc-gcc CXX=i586-mingw32msvc-g++


Next, the source is configured. This is basically the example configuration, except for things that caused warnings. Those were
removed and Fluidsynth was disabled, since it didn't compile:

./configure --host=i586-mingw32msvc --build=i386-linux \
--enable-nls --enable-sdl --with-sdl-config-path=$CONTRIBS/bin \
--enable-faad --enable-flac --enable-theora \
--with-libgcrypt-prefix=$CONTRIBS \
--enable-live555 --with-live555-tree=$CONTRIBS/live.com \
--enable-caca \
--with-dvdnav-config-path=$CONTRIBS/bin \
--disable-cddax --disable-vcdx --enable-goom \
--enable-twolame --enable-dvdread \
--enable-debug --disable-fluidsynth


Now we can finally compile and be fairly confident of success:

make
make package-win32-zip && rm -R symbols-1.0.5


After a while the compiled package vlc-1.0.5-win32.zip is ready.

When compiling for the second time, you might run into an error "qplatformdefs.h not found", described here: viewtopic.php?f=32&t=70101 . In that case you have to download ftp://ftp.videolan.org/pub/videolan/con ... in.tar.bz2 . Now run these two commands when the error occurs:

rm -R $CONTRIBS/include/qt4
tar jxf qt4-4.6.0-win32-bin.tar.bz2 --strip 1 -C $CONTRIBS --wildcards qt4-4.6.0-win32-bin/include/qt4/*


and continue with 'make'.

If you need to start over, you can simply remove the created directories:

rm -R /home/vlc/win32
----------------------------------------------------

After all of this, there's still the issue of fixing the original problems. Using flags like "--disable-telx" or "--disable-zvbi" didn't do anything, so after a few attempts I ended up modifying one of the source files:

perl -i.bak -p -e 's|PMTSetupEsTeletext\( p|\/\/ PMTSetupEsTeletext\( p|g' $CONTRIBS/modules/demux/ts.c

This disables the pesky teletext subtitle support once and for all.

I haven't really gotten around looking into the second problem, since there doesn't seem to be any obvious way to select the deinterlacing modes to compile. This problem actually contains a bug as well, after all the deinterlace hotkey doesn't really cycle the deinterlace modes like it did in the old version, just alternates between 'Discard' and 'Disable'.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: A suggestion: Add an option to disable teletext subtitling

Postby Jean-Baptiste Kempf » 04 Feb 2010 12:09

There are configure scripts for windows, in extras/packages/win32 that avoid all this mess about your configure.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

imhere
New Cone
New Cone
Posts: 8
Joined: 13 Sep 2009 10:42
VLC version: 2.2.2
Operating System: Kubuntu 16.04
Location: Helsinki, Finland

Re: A suggestion: Add an option to disable teletext subtitling

Postby imhere » 04 Feb 2010 14:57

There are configure scripts for windows, in extras/packages/win32 that avoid all this mess about your configure.
Yes, there seems to be some Windows configuration file vlc.win32.nsi.in in that directory in the source archive, presumably for the auto-installer package. How is this relevant?

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: A suggestion: Add an option to disable teletext subtitling

Postby Jean-Baptiste Kempf » 04 Feb 2010 15:40

There are configure scripts for windows, in extras/packages/win32 that avoid all this mess about your configure.
Yes, there seems to be some Windows configuration file vlc.win32.nsi.in in that directory in the source archive, presumably for the auto-installer package. How is this relevant?
No
extras/package/win32/configure-msys.sh
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

imhere
New Cone
New Cone
Posts: 8
Joined: 13 Sep 2009 10:42
VLC version: 2.2.2
Operating System: Kubuntu 16.04
Location: Helsinki, Finland

Re: A suggestion: Add an option to disable teletext subtitling

Postby imhere » 04 Feb 2010 20:05

No
extras/package/win32/configure-msys.sh
Well, there was no such file in the source archive. I found it by browsing http://git.videolan.org/ .
However, since INSTALL.win32 says
Once you've got all the files you need in place, you need to configure the
build with the `./configure' script.

I'll assume that you are using the pre-compiled 3rd party libraries we are
providing and that they are in /usr/win32.

If you are cross-compiling from Debian, you can use this:

sh extras/package/win32/configure-mingw.sh


If you are compiling with MSYS/MINGW, then you can use this:

sh extras/package/win32/configure-msys.sh
I assume you ment configure-mingw.sh (and configure-common.sh). I downloaded these and did the path replacement:

cp configure-* $CONTRIBS/extras/package/win32/

for file in $CONTRIBS/extras/package/win32/configure-* ; do perl -i.bak -p -e 's|/usr/win32|$ENV{"CONTRIBS"}|g' $file ; done


and config/make:

sh extras/package/win32/configure-mingw.sh

make


Yes, this did indeed work without problems. Although doing it this way was once again somewhat non-obvious.

Any pointers about the deinterlace problem would be helpful.

VLC_help
Mega Cone Master
Mega Cone Master
Posts: 25661
Joined: 13 Sep 2006 14:16

Re: A suggestion: Add an option to disable teletext subtitling

Postby VLC_help » 04 Feb 2010 23:20

Remove unneeded stuff from http://git.videolan.org/?p=vlc.git;a=bl ... nterlace.c (remove defines, remove static void RenderZZZZ, update mode_list and mode_list_text, update SetFilterMethod etc.)

imhere
New Cone
New Cone
Posts: 8
Joined: 13 Sep 2009 10:42
VLC version: 2.2.2
Operating System: Kubuntu 16.04
Location: Helsinki, Finland

Re: A suggestion: Add an option to disable teletext subtitling

Postby imhere » 07 Feb 2010 18:34

Remove unneeded stuff from http://git.videolan.org/?p=vlc.git;a=bl ... nterlace.c (remove defines, remove static void RenderZZZZ, update mode_list and mode_list_text, update SetFilterMethod etc.)
Thanks. After some searching I did find an easier way:
In file src/video_output/video_output.c there's a list of deinterlacing modes ( p_deinterlace_mode[] ). I commented out the 6 other modes, leaving "blend" and "linear". As I did this, somehow the hotkey mode cycling started to work correctly as well.

One other problem I came across: normally, playback takes something like 10% of one core, but when subtitles are active this goes to around 40%, in some cases up to 100% of one core and frames start dropping. CPU consumption seems to be directly proportional to the amount of subtitle real-estate on screen and this is why it can often go unnoticed if the subtitles are small and there's computational power to spare. This problem was introduced between versions 0.9.9 and 1.0.0.

viewtopic.php?f=2&t=69626&p=231143
http://old.nabble.com/Very-slow-image-w ... 52044.html

I didn't find the real cause, but at least a cure to the symptoms in modules/video_filter/blend.c:

Code: Select all

static inline int vlc_blend( int v1, int v2, int a ) { /* TODO bench if the tests really increase speed */ if( a == 0 ) return v2; else if( a == MAX_TRANS ) return v1; return ( v1 * a + v2 * (MAX_TRANS - a ) ) >> TRANS_BITS; }
I'm not sure why this innocent-looking piece of code is so slow. It's been unchanged since 0.9.9, but the handful of operations at the last line now seem to cross some kind of a threshold, after which subtitle performance goes from excellent to terrible.

As a quick fix, I've disabled alpha blending altogether:

perl -i.bak -p -e 's|else if\( a == MAX_TRANS \)|\/\/ else if\( a == MAX_TRANS \)|g' $CONTRIBS/modules/video_filter/blend.c

VLC_help
Mega Cone Master
Mega Cone Master
Posts: 25661
Joined: 13 Sep 2006 14:16

Re: A suggestion: Add an option to disable teletext subtitling

Postby VLC_help » 08 Feb 2010 13:32

imhere: could you post your findings about subtitle performance to vlc-devel mailing list?

imhere
New Cone
New Cone
Posts: 8
Joined: 13 Sep 2009 10:42
VLC version: 2.2.2
Operating System: Kubuntu 16.04
Location: Helsinki, Finland

Re: A suggestion: Add an option to disable teletext subtitling

Postby imhere » 09 Feb 2010 13:15

imhere: could you post your findings about subtitle performance to vlc-devel mailing list?
I sent a message to vlc-devel where I described what I think is the immediate cause of the bug (too extensive code cleanup prior to 1.0.0) and the underlying cause (slow access to memory). In the mean time, the easiest fix is probably one where the whole vlc_blend function only contains "return v1;"

VLC_help
Mega Cone Master
Mega Cone Master
Posts: 25661
Joined: 13 Sep 2006 14:16

Re: A suggestion: Add an option to disable teletext subtitling

Postby VLC_help » 10 Feb 2010 11:38

Thanks.


Return to “VLC media player Feature Requests”

Who is online

Users browsing this forum: No registered users and 28 guests