Go Back   Justin.tv Community Help Forums > Community Help > Tutorials

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-03-2011, 05:50 AM
georg georg is offline
Junior Member
 
Join Date: Feb 2011
Posts: 3
Default Magic command line for VLC/JTVLC in 16:9 format in Ubuntu or Linux Mint

Hi,

after fiddeling around for a while I succeeded to get VLC+JTVLC working under Ubuntu/Mint with audio working and synced for 16:9 video, including a logo. The magic command line is:

vlc -I dummy v4l2:///dev/video1 :v4l2-aspect-ratio=16\\:9 :v4l2-standard=2 :input-slave=alsa://hw:1,0 --logo-file=/home/georg/Downloads/mvlogo.png --logo-x=800 --sout='#transcode{vfilter=canvas{width=320,height=1 80,aspect=16:9},venc=x264{keyint=60,idrint=2},vcod ec=h264,vb=100,acodec=mp4a,ab=32,channels=1,sample rate=22050,sfilter=logo,audio-sync}:duplicate{dst=standard{access=file,mux=mp4,d st=/home/georg/kumma.mpg}, dst=rtp{dst=127.0.0.1,port=1234,caching=2000,rtcp-mux,sdp=file:///home/georg/vlc.sdp}}'

Explanation:

- The stream is not shown (dummy interface). Instead it is dubbed into /home/georg/kumma.mpg.

- The sdp file and jtvlc work as described in the jtvlc-wiki.

- It is important to remove or disable the pulseaudio server in order to have a working alsa interface.

- The v4l2-standard=2 above is PAL, change it at your convenience. The video camera (over a Dazzle USB converter) must be 16:9 as well.

- It is well possible to increase the canvas size and the video bandwidth.

- Important parameters (not in the jtvlc-wiki) are rtcp-mux and caching=2000 in the rtp section. The rtcp-mux prevents the client from complaining about too many reference frames and/or too old video data. The caching=2000 is necessary to have synced audio and video. Without it, video will lag behind in the rtp stream (but not in the saved mpg file).

- Extra hint: When embedding the video in other websites, change the size of the object to 640x360 which is 16:9. So there will be no black bars.


VLC was 1.1.6 (current ubuntu package for videolan.org) jtvlc was 0.41

Have fun

Georg
Reply With Quote
  #2  
Old 05-14-2012, 10:46 PM
johnfrank johnfrank is offline
Junior Member
 
Join Date: Jun 2010
Posts: 8
Default

Great post. I'll add my command to your list.

Linux Mint 12
Vlc 1.1.12
Jtvlc 0.41

Streaming a looping playlist with marque (title + time remaining) in the bottom right corner:

Quote:
vlc --loop --sout-keep --sout='#transcode{soverlay,sfilter=marq{marquee="$t $L",position=9,size=10,opacity=255},venc=x264{keyi nt=60,idrint=2},vcodec=h264,vb=350,acodec=mp4a,ab= 96,channels=2,samplerate=44100,audio-sync,deinterlace{deinterlace=linear},threads=0}:ga ther:rtp{dst=127.0.0.1,port=1234,mux=ts,ttl=30,sdp =file:///PATH-TO-SDP-FILE}"}' "PATH-TO-XSPF-PLAYLIST-FILE"
I will add your "caching=2000,rtcp-mux" portion to the command and a few more input/output resolutions in a few days.
Reply With Quote
  #3  
Old 05-18-2012, 02:32 AM
phomlish phomlish is offline
Junior Member
 
Join Date: Dec 2011
Posts: 4
Default

John Frank, I tried your vlc command:

vlc --loop --sout-keep --sout='#transcode{soverlay,sfilter=marq{marquee="$t $L",position=9,size=10,opacity=255},venc=x264{ke yi nt=60,idrint=2},vcodec=h264,vb=350,acodec=mp4a,ab= 96,channels=2,samplerate=44100,audio-sync,deinterlace{deinterlace=linear},threads=0}:ga ther:rtp{dst=127.0.0.1,port=1234,mux=ts,ttl=30,sdp =file:///PATH-TO-SDP-FILE}"}' "PATH-TO-XSPF-PLAYLIST-FILE"

It worked great for 2 days playing constantly when the files were all the same format/type. But when I added in some different file types, width/height, and bitrate, the viewer would go black when it switched to the next video. I would not mind at all pre-converting all my files, but everything I've tried has failed. Any suggestions?

thanks,
Paul

Last edited by phomlish; 05-18-2012 at 02:40 AM.
Reply With Quote
  #4  
Old 06-12-2012, 02:41 PM
johnfrank johnfrank is offline
Junior Member
 
Join Date: Jun 2010
Posts: 8
Default

Quote:
Originally Posted by phomlish View Post
John Frank, I tried your vlc command:

vlc --loop --sout-keep --sout='#transcode{soverlay,sfilter=marq{marquee="$t $L",position=9,size=10,opacity=255},venc=x264{ke yi nt=60,idrint=2},vcodec=h264,vb=350,acodec=mp4a,ab= 96,channels=2,samplerate=44100,audio-sync,deinterlace{deinterlace=linear},threads=0}:ga ther:rtp{dst=127.0.0.1,port=1234,mux=ts,ttl=30,sdp =file:///PATH-TO-SDP-FILE}"}' "PATH-TO-XSPF-PLAYLIST-FILE"

It worked great for 2 days playing constantly when the files were all the same format/type. But when I added in some different file types, width/height, and bitrate, the viewer would go black when it switched to the next video. I would not mind at all pre-converting all my files, but everything I've tried has failed. Any suggestions?

thanks,
Paul
Found another that seems to have resolved that issue.

Code:
vlc --extraintf http "/PATHTOVLCDIR/Playlist.xspf" --loop --sout='#gather:transcode{venc=x264{keyint=24,idrint=2,cabac=0,bframes=0},vcodec=h264,vb=500,fps=30,scale=1,acodec=mp3,ab=64,channels=2,samplerate=22050,audio-sync,deinterlace{deinterlace=linear},threads=0,sfilter=marq{marquee="$t - $L",position=9,size=10,opacity=255},vfilter=canvas{width=640,height=360,aspect=16:9}}:duplicate{dst=rtp{dst=127.0.0.1,port=1234,mux=ts,sdp=file:///PATHTOVLCDIR/vlc.sdp}"}'
It's held up using different video formats + different resolutions.

Also should mention I'm using the daily stable vlc ppa. https://launchpad.net/~videolan/+archive/stable-daily

To add it:

Quote:
sudo add-apt-repository ppa:videolan/stable-daily
sudo apt-get update
Also tweak the X264 settings within the preferences.

1) Preferences -> Input & Codecs -> x264 preset and tuning selection: Slower (slower results in a much better picture)
2) Preferences -> Input & Codecs -> x264 profile and level selection: High (Usually the default)

To ensure the best performance possible I recommend recompiling the latest stable vlc against the latest ffmpeg + codecs.

Here's a tutorial (with a few changes) based off this page: http://www.andrews-corner.org/vlc.html . I'm using Mint 13 (which is based off Ubuntu 12.04):

Code:
sudo apt-get remove vlc
Code:
sudo apt-get -y install build-essential git-core checkinstall automake yasm liba52-0.7.4-dev \
libaa1-dev libasound2-dev libass-dev \
libavahi-client-dev libcaca-dev libcairo2-dev libcddb2-dev libcdio-dev libdca-dev \
libdirac-dev libdvbpsi-dev libdvdnav-dev libdvdread-dev libebml-dev libfaad-dev \
libflac-dev libfluidsynth-dev libfreetype6-dev libfribidi-dev libgcrypt11-dev \
libggi2-dev libgl1-mesa-dev libglib2.0-0 libgnomevfs2-dev libgnutls-dev libhal-dev \
libid3tag0-dev libjack-jackd2-dev libkate-dev liblircclient-dev liblua5.1-0-dev \
libmad0-dev libmatroska-dev libmodplug-dev libmpcdec-dev libmpeg2-4-dev libmtp-dev \
libncursesw5-dev libnotify-dev libogg-dev liboggkate-dev libpango1.0-dev libpng12-dev \
libprojectm-dev libprojectm-qt-dev libproxy-dev libpulse-dev libqt4-dev libraw1394-dev \
librsvg2-dev libschroedinger-dev libsdl-image1.2-dev libsdl1.2-dev libshout3-dev \
libsmbclient-dev libspeex-dev libsqlite3-dev libsvga1-dev libsysfs-dev libtag1-dev \
libtar-dev libgme-dev libtheora-dev libtool libtwolame-dev libudev-dev libupnp3-dev \
libv4l-dev libva-dev libvcdinfo-dev libvorbis-dev libvpx-dev libx11-dev libx11-xcb-dev \
libxcb-composite0-dev libxcb-keysyms1-dev libxcb-randr0-dev libxcb-shm0-dev \
libxcb-xv0-dev libxcb-xvmc0-dev libxcb1-dev libxext-dev libxml2-dev libxpm-dev \
libxt-dev libxv-dev libzvbi-dev lua5.1 qt4-qtconfig libspeexdsp-dev libsamplerate0-dev
Code:
sudo apt-get -y install libfaac-dev libopencore-amrnb-dev libopencore-amrwb-dev zlib1g-dev && \
mkdir -pv $HOME/vlc_build && cd $HOME/vlc_build && \
wget http://ffmpeg.org/releases/ffmpeg-0.11.1.tar.bz2 && \
tar xjvf ffmpeg-0.11.1.tar.bz2 && cd ffmpeg-0.11.1 && \
if [ "$(uname -m)" = "x86_64" ]; then
  ARCHOPTS="--enable-pic"
 else
  ARCHOPTS=""
fi && \
./configure --prefix=$HOME/vlc_build/vlcdeps/usr \
              $ARCHOPTS \
              --enable-gpl \
              --enable-version3 \
              --enable-nonfree \
              --enable-postproc \
              --enable-pthreads \
              --enable-libfaac \
              --enable-libmp3lame \
              --enable-libopencore-amrnb \
              --enable-libopencore-amrwb \
              --enable-libvpx \
              --disable-ffmpeg \
              --disable-ffplay \
              --disable-ffserver \
              --disable-doc && \
make && make install-libs install-headers && make distclean
Code:
if [ "$(uname -m)" = "x86_64" ]; then
  ARCHOPTS="--enable-pic"
 else
  ARCHOPTS=""
fi && \
cd $HOME/vlc_build && \
git clone git://git.videolan.org/x264.git --depth 1 && \
cd x264 && \
./configure --prefix=$HOME/vlc_build/vlcdeps/usr --enable-static $ARCHOPTS && \
make && make install
Code:
cd $HOME/vlc_build && \
sudo apt-get -y remove liblivemedia-dev && \
wget http://live555sourcecontrol.googleco...1.12.23.tar.gz && \
tar xvf live.2011.12.23.tar.gz && cd live && \
if [ "$(uname -m)" = "x86_64" ]; then
  ./genMakefiles linux-64bit && make
else 
  ./genMakefiles linux && make
 fi && \
sudo cp -v \
groupsock/libgroupsock.a liveMedia/libliveMedia.a \
UsageEnvironment/libUsageEnvironment.a \
BasicUsageEnvironment/libBasicUsageEnvironment.a \
$HOME/vlc_build/vlcdeps/usr/lib/ && \
sudo cp -v \
groupsock/include/*.hh groupsock/include/*.h \
liveMedia/include/*.hh UsageEnvironment/include/*.hh \
BasicUsageEnvironment/include/*.hh \
$HOME/vlc_build/vlcdeps/usr/include/
Code:
cd $HOME/vlc_build && \
wget ftp://ftp.videolan.org/pub/videolan/...-0.2.2.tar.bz2 && \
tar xjvf libbluray-0.2.2.tar.bz2 && cd libbluray-0.2.2 && \
./configure && make && \
sudo checkinstall --pakdir "$HOME/vlc_build" --backup=no --deldoc=yes \
                  --pkgname libbluray --pkgversion "2:0.2.2" --fstrans=no \
                  --deldesc=yes --delspec=yes --default && \
make distclean
Code:
cd $HOME/vlc_build && \
sudo apt-get -y install libgcrypt11-dev bison flex && \
wget ftp://ftp.videolan.org/pub/videolan/...-0.4.0.tar.bz2 && \
tar xjvf libaacs-0.4.0.tar.bz2 && cd libaacs-0.4.0 && \
./configure && make && \
sudo checkinstall --pakdir "$HOME/vlc_build" --backup=no --deldoc=yes \
                  --pkgname libaacs --pkgversion "2:0.4.0" --fstrans=no \
                  --deldesc=yes --delspec=yes --default && \
make distclean
Code:
cd $HOME/vlc_build && \
wget ftp://ftp.videolan.org/pub/videolan/...c-2.0.1.tar.xz && \
tar Jxvf vlc-2.0.1.tar.xz && \
cd $HOME/vlc_build/vlc-2.0.1 && \
if [ ! "$(uname -m)" = "x86_64" ]; then
 ARCHOPTS="--enable-loader"
else
  ARCHOPTS=""
fi && \
./bootstrap && \
CPPFLAGS="-I$HOME/vlc_build/vlcdeps/usr/include " \
CFLAGS="-I$HOME/vlc_build/vlcdeps/usr/include"  \
CXXFLAGS="-I$HOME/vlc_build/vlcdeps/usr/include" \
LDFLAGS="-L$HOME/vlc_build/vlcdeps/usr/lib" \
PKG_CONFIG_PATH="$HOME/vlc_build/vlcdeps/usr/lib/pkgconfig" \
./configure $ARCHOPTS \
            --prefix=/usr/local \
            --enable-realrtsp \
            --enable-aa \
            --enable-merge-ffmpeg \
            --enable-vcdx \
            --enable-ncurses \
            --disable-speex && \
make && \
sudo checkinstall --pakdir "$HOME/vlc_build" --backup=no --deldoc=yes --pkgname vlc \
                  --pkgversion "2.0.1" --fstrans=no \
                  --deldesc=yes --delspec=yes --default && \
make distclean && sudo ldconfig
Once newer versions come out adjust this script to reflect those changes and recompile.

I'll keep updating this post should I come across anything else.

Last edited by johnfrank; 06-18-2012 at 02:05 AM.
Reply With Quote
  #5  
Old 07-25-2012, 09:31 PM
soulstitchmmo's Avatar
soulstitchmmo soulstitchmmo is offline
Junior Member
 
Join Date: Jul 2012
Posts: 9
Default Brand new user here

I've been tearing my brain out trying to figure out how to stream. I'm not very technically or ubuntu savvy, is there an easier command or something I can use to simply stream the content of my left monitor and my sound so I can stream in ubuntu(12.04) so I can stop having to swap to windows when i want to stream?

Is there any chance any of you wonderful individuals can write a super noobie guide to get set up streaming in Linux/Ubuntu?

Last edited by soulstitchmmo; 07-25-2012 at 09:36 PM.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 03:27 AM.