Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

My current computer is unable to run FullHD movies smoothly and I was already resigned to the idea, because it seemed a graphics card issue, mine not being powerful enought to do the work (which is still very probable). But recently a friend of mine bought a SSD and put it in a similar specs laptop and he is now able to run FullHD movies. Now I have the doubt about it being a r/w speed problem and not a GPU problem.

The question now, since I'm curious, I dont have a SSD and I have time to waste to run experiments. Is it possible to load the file on RAM and read it from there hoping the RAM reading speed will be similar to that of the SSD?

share|improve this question
What player are you using? A good player would read from the disk early enough to ensure that the data is in RAM by the time it's needed. Also, how much RAM do you have? –  Gilles May 15 '12 at 23:33
It almost certainly isn't a disk problem. Even a blue ray high def movie only needs something like 5-7 MB/s. Even slow laptop hard drives can handle 5-10 times that. –  psusi May 16 '12 at 2:10
add comment

3 Answers

up vote 4 down vote accepted

Yes it is possible. You can first mount a tmpfs partition and then play your video file from there.

I mount my /tmp partition in RAM since the contents do not need to be preserved between reboots and there are definite speed benefits. Here is my entry in my /etc/fstab which creates it on each boot: tmpfs /tmp tmpfs defaults,rw,mode=1777,size=3G 0 0

You can do something similar using the mount command as root.

share|improve this answer
With 3GB, you're not going to fit a full-HD movie, so the content of the tmpfs will overflow into swap. The only way to guarantee that the content of the file is in RAM with this method is to turn off swap. –  Gilles May 15 '12 at 23:32
That's my /tmp partition's definition. Obviously, if his file is larger than 3GB, he'll adjust accordingly, hence "You can do something similar". –  SigueSigueBen May 16 '12 at 0:05
Gilles wasn't saying you will hit the limit of the tmpfs, but rather that you will use up all of your ram and the data will go to swap anyhow, unless of course you have 8g or more of ram. –  psusi May 16 '12 at 2:07
The question was how to load a file into RAM before accessing it. Using tmpfs is one way to do this. We don't know how big the file is, but obviously, if it is larger than the amount of RAM on the system or larger than the size of the RAM-based filesystem, it won't all be in RAM. I thought that would be self-evident. –  SigueSigueBen May 16 '12 at 2:28
Since it is a test just to see if a FullHD video will be faster loading from RAM, I'm going to try this. I know I cant fit an entire movie in my RAM so I'll use a short video. By the way, is it necessary to copy the file into the mounted partition or can I link it? –  DannYO May 16 '12 at 12:14
show 5 more comments

Pre-loading a movie to memory probably only matters for network streams or if you don't want your disk respinning.

In any case you can try increasing cache size in your media player. With mplayer it can be achieved with following command.


Usually the problem with slow/choppy video is in graphics card or libraries and drivers around it. You can try other media player (vlc, xbmc) and try playing with its configuration. Again with mplayer you can try setting different video output driver using the following.

mplayer -vo <DRIVER> <VIDEO_FILE>

The argument here can be vdpau (for nVidia cards), vaapi (for Intel) etc. (check mplayer -vo help to list supported drivers).

share|improve this answer
It also seems a good option, besides I can use a full movie –  DannYO May 16 '12 at 12:33
Good answer. It's worth trying these suggestions as well. –  SigueSigueBen May 16 '12 at 13:00
add comment

A simple cat movie.mkv >/dev/null should do the trick. The reason is that the file is entirely read and files recently read are kept in the file cache by the operating system, which happens to be in RAM. However, you have no guarantee how long the file remains in memory, that depends on several factors:

  • movie size
  • memory size
  • available memory
share|improve this answer
Not quite: if the movie doesn't fit comfortably into RAM, which is the case for most people, you'll end up with only the end of the movie in RAM. –  Gilles May 15 '12 at 23:33
The title is “Preload move on RAM”, so I assume that the movie fits into the memory. Since the OP did not mention any particular values, one can only guess. –  Marco May 15 '12 at 23:45
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.