Sunday, April 12, 2009

How to stream AVI files from Linux to Linux

The How To Stream Almost Anything using VLC blog post was a great help, but the user interface in my version of VLC (0.9.8a, on both machines) was radically different from that post, and different from the VLC streaming how to page. To initially control the VLC on the source machine (the server), you either have to understand the command-line syntax, or use the VLC GUI on the server machine (which requires, in my case, tunneling the X protocol from the server machine back to the receiving machine). I followed the instructions in blog post up to where it instructs you to play the video using "Play Locally" mode to play the video on the server machine. But saw this message on the terminal window (and not in the GUI; why?):
[????????] x11 video output error: X11 request 145.1 failed with error code 10: BadAccess (attempt to access private resource denied) [????????] x11 video output notice: buggy X11 server claims shared memory [????????] x11 video output notice: support though it does not work (OpenSSH?) [????????] x11 video output error: X11 request 145.1 failed with error code 10: BadAccess (attempt to access private resource denied)
Well, of course I'm running the server's VLC over a ssh session. I want to play the video on my local machine, and not have to have access to the physical console at the server end. So, I skipped the Play Locally part of the blog post, and proceeded with the rest of the instructions. I finally got it to work, but with some modifications to the instructions in blog post. This is what I ended up doing:
  1. Run ssh into the remote machine from the local machine, tunneling X protocol back to the local machine so that I can interact with the servers VLC GUI session.
  2. At the remote machines shell prompt, invoke vlc. The key here is to invoke vlc from the shell so that you can see any errors in its terminal output, as the GUI doesn't do a good job of presenting errors.
  3. Pull down the Media menu (this is different from whats on the blog post).
  4. Select the Open File menu item.
  5. Navigate in the Open dialog box for the AVI file, and single click on it so that it is highlighted, but don't click the Play button. This stumped me a bit, since the instructions indicate that there is some streaming button in the dialog box.
  6. Look to the left of the Play button. You will see a smaller button that has a black downward pointing triangle (drop down button??). Click that and click Stream.
  7. The Stream Output window pops up.
  8. Put a checkbox beside RTP here. Then also select "Prefer UDP over RTP". In the Address field beside that the UDP box, enter in the IP address of the machine where you want to stream the video to, not the server machine.
  9. Leave the rest of the panels unmodified.
  10. At the bottom of the dialog box, click on Stream. You are now streaming the video. It is actually playing right now, but since you don't have the receiving end set up yet, you won't see it.
  11. On the local (receiving) end, invoke vlc.
  12. In that new VLC window, pull down the Media menu, and select Open Network.
  13. In the Protocol pulldown, select UDP (not RTP).
  14. Leave the IP address blank (another trap for the uninitiated; why does it work when it is blank?).
  15. Wait for a few seconds, as there is some bit of delay here. For me the sound starts playing pretty quickly, but it took a few seconds before the window popped up.
Problems:
  1. The VLC's streaming how to page is badly out of date. Yes, the documentation is now a wiki page, but I personally feel it is irresponsible for software developers (commercial or open-source) to make radical changes to their software packages GUI interface and not update the corresponding documentation. Updating documentation a part of the software developers job role.
  2. The VLC's streaming how to page is too complicated for performing the basic user tasks such as streaming from one system to the other.
  3. There are panels in the Open Stream dialog box that are just begging to be adjusted, but you need to leave the rest of them unmodified for this case. I would have expected the F1 key to bring up a documentation page for that complicated dialog box that would then say something like "For basic streaming of AVI files, do not change any of those other boxes unless you know what you are doing". However, context sensitive help is apparently not implemented, which is a stumbling block for new users.
  4. Pause in the receiving machines VLC window does not work. Only stop works. You either have to use the web interface as indicated in the blog post, or switch back to the servers VLC window and operate it from there (which only works when you are tunneling X protocol over ssh so as to see the servers VLC window on the local (receiving) machine).
  5. No matter what I tried, I could not get just the RTP to work, but had to also select "Prefer UDP over RTP". If you leave the port numbers all set to 1234, then you will get an "audio and video port cannot be the same" error on the terminal window where you ran vlc.
  6. In the Address field beside the UDP check box, you are to enter in the IP address of the machine where you want to stream the video to, not the server machine. Another area of confusion, as I don't see anywhere where it is explained why that is the case. Must be obvious to the networking experts, but what about the majority of users? Besides, I don't see what the advantage is for RTP, as the UDP method seems to work just fine (well, there is a lag, but maybe that occurs in both protocols??).

3 comments:

  1. Thanks man! That was really useful!

    ReplyDelete
  2. I am still having problems, mostly because I do not fully understand what you said in step 1. I know of ssh, its the tunneling of x to the remote host and back to the local maching things that has me confused. could you explain that in some more detail?

    ReplyDelete
  3. Hi Detrix42. Yes, I was a bit vague on the SSH aspect of it since I am presuming that SSH has been set up. After I has posted that, I ended up cooking up a nice Perl script that performs some of those steps. I explain the steps in greater detail with a new blog post at http://bgoodr.blogspot.com/2009/08/usage-of-ssh-and-vlc.html

    Thanks,
    Brent

    ReplyDelete