Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.5: Use Automator to set VLC caching delays Apps
This hint suggests a quick and easy way to change the amount of milliseconds VLC caches for videos. The purpose is to provide an easy method to increase the number of cached seconds when you're streaming a video over your local network, and decrease them when you're watching a video that is a local file -- without having to navigate the complex menu structure in VLC's preferences each time you want to switch. It is implemented using two Automator apps; for best mileage, I recommend using them in conjunction with Quicksilver.

I watch a lot of videos on my Mac, and I watch them all with VLC. Sometimes I stream them from my dedicated server (a linux box on my network in my closet mounted over samba), and sometimes I watch them locally. VLC defines several "access modules," or ways for the application to access videos. For example: File, HTTP, FTP, etc. Both local videos and videos on a samba mount are accessed with the File module.

By default, the file module caches 300ms of the video before it starts to play. If the file is on your local machine, it starts almost instantly, and (usually) does not skip or buffer at all during playback. That's good and well for a local file, but for a file on a samba (nfs/afp/whatever) mount getting streamed over the local network, it's not enough. The video constantly pauses and skips while it waits for data to come across the wire. Before I started tinkering with the settings, I was copying videos from my samba mount to my machine before watching them, just to side step this problem. Then I discovered that the caching time is configurable. To change it, go to VLC » Preferences » Input / Codecs » Access Modules » File » [click the 'Advanced' checkbox]. Then you can change the value for 'Caching value in ms.' I use 5000 (5 seconds) when I'm streaming, and the default of 300 when I'm local.

This can also be configured by editing the file ~/Library/Preferences/VLC/vlcrc, specifically the file-caching key/value pair. However, with this method, you must quit VLC before changing the file.

With that, here's the basic flow of my workflows [108KB download]:
  1. Quit VLC
  2. Pause 1 second
  3. Execute shell command
  4. Pause 1 second
  5. Launch VLC
The first pause is to wait for VLC to write out the vlcrc file; without this, our changes in the shell-script step get clobbered. The second pause may not be as important, but for some reason it was necessary to get this working on my machine. The shell command for the network video workflow is this:
perl -pi -e 's/#?file-caching=\d+/file-caching=300/g' ~/Library/Preferences/VLC/vlcrc
The shell command for the "local video" workflow is identical, except the substitution value is 300 instead of 5000. I saved these from automator as Applications, local_video.app and network_video.app. Then, using Quicksilver, I just type the one of the following key sequences to switch back and forth:
[open-apple] [space] netwo [enter]
[open-apple] [space] loca [enter]
Of course, you'll have to do this several times and manually choose the correct app to train VLC to open network_video.app instead of Network Prefernces.app.

[robg adds: These workflows could probably be modified to work in 10.5 (using shell scripts for the delays), but as written, they require 10.5.]
    •    
  • Currently 2.71 / 5
  You rated: 2 / 5 (7 votes cast)
 
[25,134 views]  

10.5: Use Automator to set VLC caching delays | 9 comments | Create New Account
Click here to return to the '10.5: Use Automator to set VLC caching delays' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.5: Use Automator to set VLC caching delays
Authored by: ts on Nov 19, '07 03:31:47PM

This hint could not have come at a better time, you just made a few things so much easier to deal with. Thanks!



[ Reply to This | # ]
10.5: Use Automator to set VLC caching delays
Authored by: ts on Nov 19, '07 03:37:33PM

also, i have them linked to a Quicksilver trigger. Makes it easier than trying to retrain QS if you use something similar already.



[ Reply to This | # ]
10.5: Use Automator to set VLC caching delays
Authored by: sapporo on Nov 20, '07 01:56:49AM

This could be so much simpler if that preference were AppleScriptable. Have you considered implementing this (VLC is open source) yourself or requesting this feature on their mailig list?



[ Reply to This | # ]
10.5: Use Automator to set VLC caching delays
Authored by: nclark42 on Dec 06, '07 06:48:07PM

nah, i don't know the first thing about apple script... i wouldn't mind it as an option, but i have a solution that works for me :)



[ Reply to This | # ]
anybody figured out a 30sec skip?
Authored by: airdrummer on Nov 20, '07 05:15:45PM

i've tried to add a relative seek to the web interface, but the docs are clear as mud;-}



[ Reply to This | # ]
anybody figured out a 30sec skip?
Authored by: airdrummer on Nov 21, '07 04:54:22PM
10.5: Use Automator to set VLC caching delays
Authored by: xSmurf on Nov 20, '07 07:13:43PM
I hope this works with the latest VLC (svn). I don't know if they'll keep it that way, but changing cache delays has been removed from the preferences!!! I'll test this soon and report back!

---
MacBook Pro 2.16Ghz / 2Gb / 100Gb 7200rpm / CD/DVD±RW
PM G4 DP 800 / 1.25gb / 120Gb+80Gb / CD/DVD±RW/RAM/DL
- The only APP Smurf

[ Reply to This | # ]

10.5: Use Automator to set VLC caching delays
Authored by: rko618 on Dec 06, '07 03:35:27AM
I expanded on this idea and wrote a similar automator script that serves as a plugin for finder instead of a standalone action. Instead of running the network or the local script to change the preference with mine you right click on the video in finder, select the plugin and the script will set your VLC cache preference to either 300 ms or 5000 ms depending on if it is a local or a network file.

http://thinkingdigitally.com/?p=6

[ Reply to This | # ]
10.5: Use Automator to set VLC caching delays
Authored by: sabberworm on Mar 15, '14 11:56:36PM
Note that the location of the settings file has changed from ~/Library/Preferences/VLC/vlcrc to ~/Library/Preferences/org.videolan.vlc/vlcrc.

[ Reply to This | # ]