LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Password
Fedora This forum is for the discussion of the Fedora Project.

Notices

Reply
 
Search this Thread
Old 03-23-2012, 10:00 PM   #3511
daftcat
mlbviewer Maintainer
 
Registered: Apr 2008
Posts: 1,745

Rep: Reputation: 76
Revision 336: Adaptive streaming control


Sorry for all the revisions today but I think you'll like this one.

With the introduction of the control to lock down the stream speed in the last revision, I decided to spin this another way and make adaptive streaming a feature.

Basic service users, the "HD" indicator has been changed to say "[ STRICT ]". Basic service doesn't have adaptive streaming so you'll always see that. I'm open to other wording of that indicator.

Nexdef users, thanks to mlbhls, you do have the option of adaptive streaming. Adaptive streaming starts with a low quality stream but then it adjusts up to the best quality that you have specified in max_bps. If you have later encounter problems receiving that stream, it will downshift to a lower quality stream. It will then try the high quality stream if you encounter no problems with the lower quality stream. It's basically the same concept as the adaptive streaming in the official NexDef plugin through the flash applet.

The strict_stream option I reintroduced in the last revision, I have now changed its name to adaptive_stream. I have also flipped the values. Setting adaptive_stream=0 means don't use adaptive streaming while setting adaptive_stream=1 will use adaptive streaming.

When you have nexdef enabled in mlbviewer and you have adaptive streaming enabled, the indicator that used to say [HD] will now say [ADAPTIVE]. If you disable adaptive streaming, it will show [ STRICT ]. You can turn on this feature through mlbviewer by pressing the 'p' key with nexdef enabled. Normally the 'p' key would change the stream speed for basic service users, but with nexdef enabled, this key toggles whether or not to use adaptive streaming.

I have done some basic testing and it looks to be working well.
 
Old 03-24-2012, 05:46 AM   #3512
daftcat
mlbviewer Maintainer
 
Registered: Apr 2008
Posts: 1,745

Rep: Reputation: 76
Didn't like "[ADAPTIVE]" and "[ STRICT ]" -- or rather, I didn't like "[ STRICT ]"

Changed it to "[>>]" for adaptive and "[--]" for not adaptive (aka "strict")

Config file option is adaptive_stream

"p" key in nexdef mode to change it dynamically.

Also tweaked it so 500000 (500K) is the default start value for adaptive (rather than 100K) and min_bps is also the default start value for adaptive (e.g. mlbhls -m <min_bps> -s <min_bps> -b <max_bps> ... etc)

Test and enjoy!

Last edited by daftcat; 03-24-2012 at 05:50 AM.
 
Old 03-24-2012, 02:25 PM   #3513
fang2415
Member
 
Registered: Jan 2007
Posts: 159

Rep: Reputation: 15
Amazing work as always, daftcat, thanks a ton.

mlbviewer r339, mlbhls r56:
For some reason mplayer doesn't seem to like the streams I download with the strict nexdef setting, and vlc plays the video but there's no sound. Not sure if that's an mlbviewer issue or mlbhls but I thought I'd mention it here (since the mlbhls dev may see it here anyway!). With the adaptive setting, I can view it in mplayer fine, although the player seems to crash sometimes when I try to seek back across a speed change. Not sure if there's anything to be done about that since it seems like an mplayer bug, but I mention it just in case...

I'm locked out now so I can't do more testing for a while, but basic has been working great the past few days and it looks like nexdef is usable now too. Thanks again to both devs for the terrific work.

Incidentally, I actually think "ADAPTIVE" and "STRICT" are a lot clearer than ">>" and "--"! Maybe make it "ADAPTIVE" and "FIXED" instead? Or maybe "+-" and "--"? Obviously no big deal, just throwing ideas at you.

Last edited by fang2415; 03-24-2012 at 02:26 PM.
 
Old 03-24-2012, 02:53 PM   #3514
daftcat
mlbviewer Maintainer
 
Registered: Apr 2008
Posts: 1,745

Rep: Reputation: 76
Quote:
Originally Posted by fang2415 View Post
Amazing work as always, daftcat, thanks a ton.

mlbviewer r339, mlbhls r56:
For some reason mplayer doesn't seem to like the streams I download with the strict nexdef setting, and vlc plays the video but there's no sound. Not sure if that's an mlbviewer issue or mlbhls but I thought I'd mention it here (since the mlbhls dev may see it here anyway!). With the adaptive setting, I can view it in mplayer fine, although the player seems to crash sometimes when I try to seek back across a speed change. Not sure if there's anything to be done about that since it seems like an mplayer bug, but I mention it just in case...

I'm locked out now so I can't do more testing for a while, but basic has been working great the past few days and it looks like nexdef is usable now too. Thanks again to both devs for the terrific work.

Incidentally, I actually think "ADAPTIVE" and "STRICT" are a lot clearer than ">>" and "--"! Maybe make it "ADAPTIVE" and "FIXED" instead? Or maybe "+-" and "--"? Obviously no big deal, just throwing ideas at you.
It's likely that your ffmpeg needs updating. Short of rebuilding, see if there is newer mplayer or vlc binaries you can install.

Also, what settings are you using for min_bps and max_bps? I would leave min_bps alone at 500000 or maybe bump that to 800000. max_bps should be one of the supported streams (200, 500, 800, 1200, 2400, 3000, or 4500 - don't forget to add three zeroes.)

As for the indicator, whatever I choose, you'll get used to it. I just thought [ADAPTIVE] and [FIXED] or [STRICT] was too wordy. You really only need an indicator to show which you're using. I thought about [+-] and [--]. [>>] looks more dynamic and is easier to see the difference between the modes.
 
Old 03-24-2012, 04:59 PM   #3515
fang2415
Member
 
Registered: Jan 2007
Posts: 159

Rep: Reputation: 15
Quote:
Originally Posted by daftcat View Post
It's likely that your ffmpeg needs updating. Short of rebuilding, see if there is newer mplayer or vlc binaries you can install.
Nothing in the repos that I can see. I'd rather keep muddling through with what I've got now than compiling them fresh, and I imagine it's the same for most other users. There should be a new Ubuntu release out soon though so that may have newer binaries.

The seeking thing seems like a bug, but the fact that both mplayer and vlc choke on the fixed-rate stream makes me think that something else is going on with that stream or with a common dependency or something. I've attached the mplayer error output for that stream in case it helps anyone.

Quote:
Also, what settings are you using for min_bps and max_bps? I would leave min_bps alone at 500000 or maybe bump that to 800000. max_bps should be one of the supported streams (200, 500, 800, 1200, 2400, 3000, or 4500 - don't forget to add three zeroes.)
I've got "max_bps=1200000" and no min_bps setting.

Quote:
As for the indicator, whatever I choose, you'll get used to it. I just thought [ADAPTIVE] and [FIXED] or [STRICT] was too wordy. You really only need an indicator to show which you're using. I thought about [+-] and [--]. [>>] looks more dynamic and is easier to see the difference between the modes.
Yeah, wha'evs. I know what it is now so I don't care. But if I did what I sometimes do and didn't see the change until four months after this dicussion, I doubt I'd have a clue what the symbols meant! But you're right, it does look dynamic.
Attached Files
File Type: txt mlbviewer_mplayer_error.txt (2.1 KB, 4 views)
 
Old 03-24-2012, 05:53 PM   #3516
chrisVV
Member
 
Registered: Aug 2010
Posts: 108

Rep: Reputation: 1
I get the opposite of the fang2415. With vlc, fixed bitrate with mlbhls works really well, with so far none of the drop outs you can get with the standard stream, whereas it chokes when adaptive bitrate is chosen and mlbhls tries to change bitrate. mplayer doesn't work at all well: sometimes it doesn't start displaying the incoming stream at all (it will usually start on a live stream and not on an archived stream), and when it does start it can hang when the audio channel is changed. However I get similar problems with mplayer with the standard stream (absent the audio channel issue which is not relevant). This is on the MLB.TV basic (non-premium) package.

This seems to be a vlc/mplayer/mlbhls thing. The command line emitted by mlbviewer to mlbhls seems to be fine.

I have one different suggestion. There seems little point in having both use_mlbhd and use_nexdef options, since they are concerned with the same thing now. I am not sure how (if at all) they differ, but we only need one. I have both set for mlbhls, and neither set for the standard stream.
 
Old 03-24-2012, 05:57 PM   #3517
daftcat
mlbviewer Maintainer
 
Registered: Apr 2008
Posts: 1,745

Rep: Reputation: 76
I'd say just checkout an SVN release of mplayer and rebuild it. From your log, it seems like you're missing the audio codec in the mplayer you have. I don't see anything or maybe just too green with the video to comment on why the video isn't there.

As for the seeking, if that's important to you, I would say build an SVN release of mplayer and try again. If you still have problems seeking, trim your video file down to just the problem area (a few seconds before and a few seconds after the stream switch) and file a bug with mplayer/ffmpeg team including the sample video file.
 
Old 03-24-2012, 06:17 PM   #3518
chrisVV
Member
 
Registered: Aug 2010
Posts: 108

Rep: Reputation: 1
Quote:
Originally Posted by daftcat View Post
I'd say just checkout an SVN release of mplayer and rebuild it. From your log, it seems like you're missing the audio codec in the mplayer you have. I don't see anything or maybe just too green with the video to comment on why the video isn't there.
I did try rebuilding, with the snapshot for March 22. All the codecs are there: it plays for a short while after changing audio channels and then usually "sticks", although sometimes changing audio channels works fine. I actually think it is some kind of synchronization issue with this year's streams and/or something to do with empty pre-season audio channels, as last year's archives work OK. However, to be honest I am not that bothered as vlc works fine.
 
Old 03-24-2012, 07:32 PM   #3519
daftcat
mlbviewer Maintainer
 
Registered: Apr 2008
Posts: 1,745

Rep: Reputation: 76
Quote:
Originally Posted by chrisVV View Post
I get the opposite of the fang2415. With vlc, fixed bitrate with mlbhls works really well, with so far none of the drop outs you can get with the standard stream, whereas it chokes when adaptive bitrate is chosen and mlbhls tries to change bitrate. mplayer doesn't work at all well: sometimes it doesn't start displaying the incoming stream at all (it will usually start on a live stream and not on an archived stream), and when it does start it can hang when the audio channel is changed. However I get similar problems with mplayer with the standard stream (absent the audio channel issue which is not relevant). This is on the MLB.TV basic (non-premium) package.

This seems to be a vlc/mplayer/mlbhls thing. The command line emitted by mlbviewer to mlbhls seems to be fine.

I have one different suggestion. There seems little point in having both use_mlbhd and use_nexdef options, since they are concerned with the same thing now. I am not sure how (if at all) they differ, but we only need one. I have both set for mlbhls, and neither set for the standard stream.
I have already deprecated use_mlbhd. In fact, it doesn't appear in the code anymore. I had already come to the same conclusion that when I had done away with all code and references to autobahn.jar, use_mlbhd was no longer necessary. mlbhls is mandatory for nexdef operation with mlbviewer for 2012 (and hopefully beyond.)

Apparently, I am using mplayer2. The fact that 'which mplayer' returns /usr/local/bin/mplayer tells me that I must have built it from source rather than using a binary. And sure enough, in my Downloads directory, I have the following subdirectory:

Code:
mplayer2-build-2.0
I don't remember how I built this (what commands/options) but it should be in the README file. Maybe tomorrow I will take a stab at rebuilding it and post some instructions.

With my mplayer, I don't have any issues with audio or video, adaptive or otherwise.

More information on my specific mplayer2 compilation/installation:

Quote:
matthew@jitterbug:~/mlbtv/svn/mlbviewer$ mplayer -vo help
MPlayer2 2.0 (C) 2000-2011 MPlayer Team
Available video output drivers:
xv X11/Xv
gl_nosw OpenGL no software rendering
x11 X11 ( XImage/Shm )
xover General X11 driver for overlay capable video output drivers
gl OpenGL
gl2 X11 (OpenGL) - multiple textures version
dga DGA ( Direct Graphic Access V2.0 )
fbdev Framebuffer Device
fbdev2 Framebuffer Device
matrixview MatrixView (OpenGL)
v4l2 V4L2 MPEG Video Decoder Output
null Null video output
mpegpes MPEG-PES to DVB card
yuv4mpeg yuv4mpeg output for mjpegtools
png PNG file
jpeg JPEG file
tga Targa output
pnm PPM/PGM/PGMYUV file
md5sum md5sum of each frame

matthew@jitterbug:~/mlbtv/svn/mlbviewer$ mplayer -ao help
MPlayer2 2.0 (C) 2000-2011 MPlayer Team
Available audio output drivers:
oss OSS/ioctl audio output
alsa ALSA-0.9.x-1.x audio output
mpegpes DVB audio output
v4l2 V4L2 MPEG Audio Decoder output
null Null audio output
pcm RAW PCM/WAVE file writer audio output
 
Old 03-24-2012, 08:06 PM   #3520
thegryghost
LQ Newbie
 
Registered: Mar 2009
Distribution: Gentoo
Posts: 28

Rep: Reputation: 1
Quote:
Originally Posted by chrisVV View Post
I did try rebuilding, with the snapshot for March 22. All the codecs are there: it plays for a short while after changing audio channels and then usually "sticks", although sometimes changing audio channels works fine. I actually think it is some kind of synchronization issue with this year's streams and/or something to do with empty pre-season audio channels, as last year's archives work OK. However, to be honest I am not that bothered as vlc works fine.
ffmpeg (which can affect both vlc and mplayer) sometimes has issues properly parsing MPEG-TS files. The last time I checked, there were a couple of bugs in mplayer that prevented the playing of certain h264 profiles/levels muxed into a MPEG-TS. You can try a different demuxer with mplayer:

Code:
mplayer -mc 20 -demuxer mpegts -correct-pts  <...> 
or
mplayer -demuxer lavf <...>
Since I use VDPAU, I generally stay away from VLC since it's implementation of VDPAU isn't optimal but is fine if you use VAAPI or no hardware assisted decoding. I personally use mplayer2 with some custom patches that allow for "live" seeking/pausing. Let me know if you want to try it out, it can play every bitrate mlb.tv streams out and handle video resolution/bitrate switches. You will have to compile it manually tho.
 
1 members found this post helpful.
Old 03-25-2012, 07:13 AM   #3521
chrisVV
Member
 
Registered: Aug 2010
Posts: 108

Rep: Reputation: 1
Quote:
Originally Posted by thegryghost View Post
ffmpeg (which can affect both vlc and mplayer) sometimes has issues properly parsing MPEG-TS files. The last time I checked, there were a couple of bugs in mplayer that prevented the playing of certain h264 profiles/levels muxed into a MPEG-TS. You can try a different demuxer with mplayer:

Code:
mplayer -mc 20 -demuxer mpegts -correct-pts  <...> 
or
mplayer -demuxer lavf <...>
Since I use VDPAU, I generally stay away from VLC since it's implementation of VDPAU isn't optimal but is fine if you use VAAPI or no hardware assisted decoding. I personally use mplayer2 with some custom patches that allow for "live" seeking/pausing. Let me know if you want to try it out, it can play every bitrate mlb.tv streams out and handle video resolution/bitrate switches. You will have to compile it manually tho.
I have done some tests, although there are lots of "it seems" below because testing is difficult, as you are locked out if you try to log in more than twice in any period of 1 hour.

Unforked mplayer

First, unlike with my old version of mplayer, it seems a recent build of unforked mplayer will play the standard streams correctly. However, it doesn't play for me reliably via mlbhls unless I include the '-demuxer lavf' option. With that option, streams appear to start correctly and the audio channels make much more sense (without it, mplayer seems to think there are various bogus audio channels). I did get one case of the stream dropping out, but the sample is too small to indicate whether that is meaningful.

Mplayer2 (forked mplayer)

I have only tested this with mlbhls, not the standard streams, and only one game, but mplayer2-build-2.0 seems to work out of the box (it is not necessary to pick particular demuxers).

So people who want to use nexdef/mlbhls might be well advised to install mplayer2 rather than the unforked mplayer, or be prepared to play around with the demuxer settings to get something which works for them.

I don't have an nvidia card and I haven't installed intel's libva (which I don't think mplayer supports anyway), so probably mplayer and vlc use xv overlay acceleration. Whatever they use seems to work fine: my 12 inch network with cheapo intel graphics plays the 2400kb stream fine in full screen mode - much better than flashplayer's (I think OpenGL-based) acceleration, which can just about manage 1200k with a following wind on that device.

I would be interested in trying your mplayer2 patches. Can you attach them here or would you like an e-mail address?
 
Old 03-25-2012, 03:28 PM   #3522
daftcat
mlbviewer Maintainer
 
Registered: Apr 2008
Posts: 1,745

Rep: Reputation: 76
Revision 341: Single sign-on login code :)

MLBAM finally got aggressive enough with Sign-On Restriction Error so...

Here it is.

First attempt at moving all the login/cookie/session key code into a new MLBSession class.

When mlbviewer starts up, it logs into mlb.com and gets all the session data. From that point forward, there will be no more logins. It will reuse whatever session data it has from that initial login. The session key may get overwritten by media request/reply but all the other cookie data remains constant.

Initial testing is promising. I have been hopping from stream to stream, live, archived, nexdef, non-nexdef, today, yesterday, etc. Lots of media requests and no sign-on restriction error yet.

One thing I do not do is check whether any of the cookies expire. Therefore, if you later encounter problems with session data being stale (I have not seen this yet), just exit mlbviewer. When you start it again, it will re-login.

Since this is a new way of doing things and a lot of shuffling of code, I expect bugs. So far, I think I have it working well enough to let you guys take a crack at it.

Hopefully we have seen the end of Sign-On Restriction Errors.
 
Old 03-25-2012, 04:26 PM   #3523
daftcat
mlbviewer Maintainer
 
Registered: Apr 2008
Posts: 1,745

Rep: Reputation: 76
Revision 344: Fixed login success determination

Single sign-on code seems to be holding up really well. I've been doing a lot of testing and haven't been locked out yet.

I did realize (as did someone else earlier this spring) that the login success determination was not working. I have finally fixed this. Since login session data is vital to everything else, I will print an error message and exit if your login was unsuccessful (I do have three retries in there to account for any network timeouts) and all other errors in the new login code will be raised with a stack trace and exit. If you encounter any of these errors, please post them here with the full stack trace.

Thanks and enjoy the new code!
 
Old 03-25-2012, 07:16 PM   #3524
fang2415
Member
 
Registered: Jan 2007
Posts: 159

Rep: Reputation: 15
Hmm yeah now with a different stream mplayer (1) crashes for the adaptive-rate same as it did before for fixed-rate. -demuxer lavf gets some playback, but any seeking at all crashes it. And no sound in VLC.

Annd now just tried mplayer2 which seems to play the stream fine but any seeking crashes it even for saved files. I guess maybe compiling with the patches could fix that, but to be honest I'd probably prefer to just stick with the basic stream over compiling a new video player.

What I'm wondering is why it worked fine before the recent changes? I thought all that had changed for the static streams was the authentication, but the stream itself must be different if mplayer 1 could read the streams I downloaded last week but not the ones I download now?

Last edited by fang2415; 03-25-2012 at 07:22 PM. Reason: clarity
 
Old 03-25-2012, 07:21 PM   #3525
fang2415
Member
 
Registered: Jan 2007
Posts: 159

Rep: Reputation: 15
Hmm, and I just got a sign-on restriction error with r344. Not sure of the precise sequence, but basically what I've been doing is running mlbviewer, downloading the first 100M or so of a nexdef stream, then hitting "q" to go back to the listings screen, then quitting mlbviewer, then repeating. A few cycles of that seems to have gotten me locked. No biggie for now but I thought you might appreciate the bug report!
 
  


Reply

Tags
help, install, installation, instructions, seek, vlc, windows


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
mlb.com gameday audio stream statmobile Linux - Newbie 6 05-06-2008 10:16 PM
link dies intermittently-seemingly at random- between win<->linux not linux<->linux?? takahaya Linux - Networking 10 03-09-2007 10:37 PM
triple boot linux/linux/linux No Windows involved toastermaker Linux - Newbie 12 03-02-2006 10:40 PM
Redhat (rhel v2.1) bootup problem with linux (linux vs linux-up) namgor Linux - Software 2 06-24-2004 02:49 PM


All times are GMT -5. The time now is 09:37 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration