VideoCache
Videocache is no longer in development.

Video cache not working On centos 5.5

by Shahbaz on 27 Oct 2010

im using contos 5.5
i have installed squid 2.7 stable7 in it
then write this lines on videocache config for squid file

# --BEGIN-- videocache config for squid
url_rewrite_program /usr/bin/python /usr/share/videocache/videocache.py
url_rewrite_children 10
acl videocache_allow_url url_regex -i \\.youtube\\.com\\/get_video\\?
acl videocache_allow_url url_regex -i \\.googlevideo\\.com\\/videoplayback \\.googlevideo\\.com\\/videoplay \\.googlevideo\\.com\\/get_video\\?
acl videocache_allow_url url_regex -i \\.google\\.com\\/videoplayback \\.google\\.com\\/videoplay \\.google\\.com\\/get_video\\?
acl videocache_allow_url url_regex -i \\.google\\.[a-z][a-z]\\/videoplayback \\.google\\.[a-z][a-z]\\/videoplay \\.google\\.[a-z][a-z]\\/get_video\\?
acl videocache_allow_url url_regex -i (25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$
acl videocache_allow_url url_regex -i (25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$
acl videocache_allow_url url_regex -i (25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$
acl videocache_allow_url url_regex -i proxy[a-z0-9\\-][a-z0-9][a-z0-9][a-z0-9]?\\.dailymotion\\.com\\/
acl videocache_allow_url url_regex -i vid\\.akm\\.dailymotion\\.com\\/
acl videocache_allow_url url_regex -i [a-z0-9][0-9a-z][0-9a-z]?[0-9a-z]?[0-9a-z]?\\.xtube\\.com\\/(.*)flv
acl videocache_allow_url url_regex -i bitcast\\.vimeo\\.com\\/vimeo\\/videos\\/
acl videocache_allow_url url_regex -i va\\.wrzuta\\.pl\\/wa[0-9][0-9][0-9][0-9]?
acl videocache_allow_url url_regex -i \\.files\\.youporn\\.com\\/(.*)\\/flv\\/
acl videocache_allow_url url_regex -i \\.msn\\.com\\.edgesuite\\.net\\/(.*)\\.flv
acl videocache_allow_url url_regex -i media[a-z0-9]?[a-z0-9]?[a-z0-9]?\\.tube8\\.com\\/ mobile[a-z0-9]?[a-z0-9]?[a-z0-9]?\\.tube8\\.com\\/
acl videocache_allow_url url_regex -i \\.mais\\.uol\\.com\\.br\\/(.*)\\.flv
#acl videocache_allow_url url_regex -i \\.video[a-z0-9]?[a-z0-9]?\\.blip\\.tv\\/(.*)\\.(flv|avi|mov|mp3|m4v|mp4|wmv|rm|ram)
acl videocache_allow_url url_regex -i \\.video[a-z0-9]?[a-z0-9]?\\.blip\\.tv\\/(.*)\\.(flv|3gp|mp3|wmv|mp4|rm|ram|mov|avi|m4v)
acl videocache_allow_url url_regex -i video\\.break\\.com\\/(.*)\\.(flv|mp4)
acl videocache_allow_dom dstdomain .mccont.com dl.redtube.com .cdn.dailymotion.com .youtube .youtube.com
acl videocache_deny_url url_regex -i http:\\/\\/[a-z][a-z]\\.youtube\\.com http:\\/\\/www\\.youtube\\.com
url_rewrite_access deny videocache_deny_url
url_rewrite_access allow videocache_allow_url
url_rewrite_access allow videocache_allow_dom
redirector_bypass on
# --END-- videocache config for squid

problem is when youtube cached and then showed like that in proxy.domain.com/videocache

 2b899afdde526477 28-Oct-2010 01:31  10M 
 2de1fb64a0f55b9d 28-Oct-2010 01:53  14M 
 3e5e2571cd5616c9 28-Oct-2010 01:32  21M 
 5a7e2758b7e0d2cf 28-Oct-2010 01:33  2.0M 
 6f33455bac4d004f 28-Oct-2010 01:27  19M 
 7cc4b451c0ce3a8a 28-Oct-2010 01:25  4.7M 
 8ee8bf87eb715315 28-Oct-2010 01:25  8.5M 
 24bac65323d89fdb 28-Oct-2010 01:25  3.3M 

and other side dailymotion and redtube video.google.com not getting cached even no error shown when i brows this websited for cache....

youtube cache error:

2010-10-28 03:42:12,013 24790 172.16.0.55 - REQUEST - http://s2.youtube.com/s?yttk=1&ns=yt&ctp=1&plid=AASToOwjLdV1Gpgz&docid=4JfepztK9G0&fmt=34&vid=cT3PUO--KFyTol29agPznI_8jbYVnJZ9C&el=detailpage&et=0.2&asv=3&st=0.2
2010-10-28 03:42:31,932 24790 172.16.0.55 - REQUEST - http://s2.youtube.com/s?yttk=1&ns=yt&ctp=2&plid=AASToOwjLdV1Gpgz&docid=4JfepztK9G0&fmt=34&vid=cT3PUO--KFyTol29agPznI_8jbYVnJZ9C&el=detailpage&et=20.22&asv=3&st=20.22
2010-10-28 03:42:41,733 24790 172.16.0.55 - REQUEST - http://s2.youtube.com/s?yttk=1&ns=yt&ctp=3&plid=AASToOwjLdV1Gpgz&docid=4JfepztK9G0&fmt=34&vid=cT3PUO--KFyTol29agPznI_8jbYVnJZ9C&el=detailpage&et=30.03&asv=3&st=30.03

my /etc/videocache.conf:

[main]
# file : /etc/videocache.conf

# This option controls the global behavior of videocache plugin.
# If it is 0, videocache will stop caching or serving anything.
# This option's value can be either 0 or 1.
enable_video_cache = 1

# The hostname or IP address of the system on which caching is being done. This is
# used for serving the videos from the cache. Please don't use http:// or slashes (/).
# Just specify the domain name or IP address.
# Example : localhost.localdomain
# or proxy.example.com
# or 192.168.36.204
# or <Proxy_Server_IP_OR_Domain>
cache_host = 172.16.0.1

# Proxy for http content.
# Example : http_proxy = http://<Proxy_Server_IP_OR_Domain>:<Proxy_port>/
# or http://proxy.example.com:3128/
proxy = http://172.16.0.1:8080/

# If the above proxy requires authentication, please specify the username.
proxy_username =

# If the above proxy requires authentication, please specify the password.
proxy_password =

# No of times a video should be requested before we start caching it.
hit_threshold = 1

# Base directories for caching the videos.
# You can specify multiple caching directories here separated by '|' symbol along
# with their sizes. Size of directories are in Mega Bytes. Don't append M or MB.
#
# EXAMPLE 1: To keep /videocache1 with size 700MB and /videocache2 with size 2GB as
# your cache directories, set base_dir to
# base_dir = /videocache/ : 700 | /videocache2:2048
#
# EXAMPLE 2: To keep /videocache1 with unlimit# EXAMPLE 2: To keep /videocache1 with unlimited storage and /videocache2 with 2GB as
# your cache directory, set base_dir to
# base_dir = /videocache/ | /videocache2/:2048
#                   OR
# base_dir = /videocache/:0 | /videocache2/:2048
# ZERO size specifies unlimited storage.
# Please try to avoid special characters in directory names like spaces, $ etc.
base_dir = /var/spool/videocache/

# This option sets the minimum available free space in Mega Bytes that is left in a
# partition containing a cache directory before videocache treats that partition as FULL.
#
# EXAMPLE: If disk_avail_threshold = 200, videocache will stop caching videos in a cache
# directory if the free space available in a partition containing that cache directory is
# less than 200 Mega Bytes.
disk_avail_threshold = 100

# Directory to store partially downloaded videos. Directory name is relative to base_dir.
temp_dir = tmp

# The maximum number of parallel downloads allowed. If all connections are consumed,
# videos will be queued for download.
max_parallel_downloads = 30

# Enables the videocache cleaner script which will remove videos
# from cache which have not been used since long.
# The value of this option can be 0 or 1.
enable_videocache_cleaner = 1

# The maximum life of a video in cache without being used. If the video was not accessed
# for more than 'video_lifetime' days, it'll be removed from the cache. The unit of
# video_lifetime is days.
# For Example : video_lifetime = 3 will remove videos which were not used since last 3 or more days.
video_lifetime = 60

# Directory where videocache logs will be stored.
logdir = /var/log/videocache/

# Maximum size of logfile specified above. The size is in mega bytes.
# Note : Please don't use max_logfile_size = 10MB. Don't append MB.
max_logfile_size = 10ed storage and /videocache2 with 2GB as
# your cache directory, set base_dir to
# Note : Please don't use max_logfile_size = 10MB. Don't append MB.
max_logfile_size = 10

# The logfiles are automatically rotated once they have exceeded the max_logfile_size.
# max_logfile_backups is the number of backup files you want to keep.
# e.g. max_logfile_backups = 2 will keep videocache.log and videocache.log.1 and
# videocache.log.2 as logfiles.
max_logfile_backups = 10

# XMLRPCServer is used for memory sharing across different instances of
# videocache. Leave these settings as it is if you don't have a fair
# idea of XMLRPCServer. This will be same as cache_host in almost all the cases.
rpc_host = 172.16.0.1

# Please make sure this port is not currently in use. If it is in use by some
# other program, change this to some port above 1024 which is not in use by
# any other program.
rpc_port = 9100

# This option enables the caching of youtube videos.
# This option's value can be either 0 or 1.
enable_youtube_cache = 1

# Directory to cache youtube videos. Directory name is relative to base_dir.
# e.g. if you specify youtube_cache_dir = youtube, actual path for caching
# youtube videos would be /var/spool/videocache/youtube/ .
youtube_cache_dir = youtube

# Youtube videos with size more than max_youtube_video_size will not be cached. This
# size is in kilo bytes. Use 0 for unlimited caching.
# e.g. max_youtube_video_size = 10000. Only videos with size less than 10MB (10000KB)
# will be cached.
# NOTE : Don't use max_youtube_video_size = 10000KB. Don't append KB.
max_youtube_video_size = 0

# Youtube videos with size less than min_youtube_video_size will not be cached. This
# size is in kilo bytes. Use 0 for no lower limit.
# e.g. min_youtube_video_size = 10. Only videos with size more than 10KB will be cached.
# NOTE : Don't use min_youtube_video_size = 10KB. Don't append KB.
min_youtube_video_size = 0
min_youtube_video_size = 0

# Metacafe.com Options
enable_metacafe_cache = 1
metacafe_cache_dir = metacafe
max_metacafe_video_size = 0
min_metacafe_video_size = 0

# Dailymotion.com Options
enable_dailymotion_cache = 1
dailymotion_cache_dir = dailymotion
max_dailymotion_video_size = 0
min_dailymotion_video_size = 0

# Google.com Options
enable_google_cache = 1
google_cache_dir = google
max_google_video_size = 0
min_google_video_size = 0

# Redute.com Options
enable_redtube_cache = 1
redtube_cache_dir = redtube
max_redtube_video_size = 0
min_redtube_video_size = 0

# Xtube.com Options
enable_xtube_cache = 1
xtube_cache_dir = xtube
max_xtube_video_size = 0
min_xtube_video_size = 0

# Vimeo.com Options
enable_vimeo_cache = 1
vimeo_cache_dir = vimeo
max_vimeo_video_size = 0
min_vimeo_video_size = 0

# Wrzuta.pl Options
enable_wrzuta_cache = 1
wrzuta_cache_dir = wrzuta
enable_wrzuta_cache = 1
wrzuta_cache_dir = wrzuta
max_wrzuta_video_size = 0
min_wrzuta_video_size = 0

# Youporn.com Options
enable_youporn_cache = 1
youporn_cache_dir = youporn
max_youporn_video_size = 0
min_youporn_video_size = 0

# Soapbox.msn.com Options
enable_soapbox_cache = 1
soapbox_cache_dir = soapbox
max_soapbox_video_size = 0
min_soapbox_video_size = 0

# Tube8.com Options
enable_tube8_cache = 1
tube8_cache_dir = tube8
max_tube8_video_size = 0
min_tube8_video_size = 0

# Tvuol.uol.com.br Options
enable_tvuol_cache = 1
tvuol_cache_dir = tvuol
max_tvuol_video_size = 0
min_tvuol_video_size = 0

# Blip.tv Options
enable_bliptv_cache = 1
bliptv_cache_dir = bliptv
max_bliptv_video_size = 0
min_bliptv_video_size = 0

# Break.com Options
enable_break_cache = 1
break_cache_dir = break
max_break_video_size = 0
min_break_video_size = 0
min_break_video_size = 0

Please help me out for enjoy your videocache

1 Answers

by Kulbir Saini on 12 Nov 2010

Hi!

I don't see videocache reporting any errors. Can you please post a few more lines from your videocache.log file?

Thank You!