LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-25-2007, 08:30 PM   #1
leosgb
Member
 
Registered: Nov 2004
Location: Brazil
Distribution: Gentoo
Posts: 363

Rep: Reputation: 31
How to reduce video file size?


Hi,

I am trying to reduce some video files I have so that I can transfer then to my pda. These files are "small" in a desktop sense but copying many 300MB files to my pda takes a long time and besides the screen is tiny anyway so I am keeping info that I dont need and wasting precious disk space.

Does anyone have a recipe to use mplayer or anything like it to do this? I would like to keep the same video quality, just reduce the video size to loose some of the fat to produce the bigger image in my desktop. I dont want to drop frames and I dont need to change encoding formats.

Any help is appreciated. Thanks in advance.
 
Old 03-27-2007, 05:51 AM   #2
SciYro
Senior Member
 
Registered: Oct 2003
Location: hopefully not here
Distribution: Gentoo
Posts: 2,038

Rep: Reputation: 51
Mplayer also comes with "mencoder", which will allow you to re-encode video files. And yes, you do need to re-encode because what you want requires altering the existing video information from within its current codec, this can only be done by re-encoding things.

Using mencoder is a pain tho. First, what codec is the current video in? Using "copy" for the audio should be fine, and "lavc" for the video codec. Use the "scale" option with the video filter to scale things.

Code:
mencoder input -vf scale=320:200 -oac copy -ovc lavc -lavcopts vcodec=mpeg4 -o outut
That should work, resizing to 320x200 using the mpeg4 codec. Not sure how good mencoder is at guessing quality, so if your video is already crappy quality, you might want to think about lower the quality settings. Since there is so many options, and i find it all to boring, ill just leave that out, read mencoders man page if you want to learn tho, under "-lavcopts".
 
Old 06-05-2007, 08:37 PM   #3
leosgb
Member
 
Registered: Nov 2004
Location: Brazil
Distribution: Gentoo
Posts: 363

Original Poster
Rep: Reputation: 31
Hi SciYro, I tried your suggestion here several times. My movies are 352x238, 640x480, 352x240 and 448x336. My goal is to reduce the file size without loosing quality.

I tried to reduce a 352x238 movie to 300x200 (as in your example) and then to 150x100. But the file changed from: 162.035.712 bytes to: 118.582.492.

This is not what I was expecting. I thought that by reducing the screen size by a factor of 2 I would get a reduction in file size of the same order. Am I wrong? Is there any way to do what I am saying but keeping the quality?

Thank you!
 
Old 06-05-2007, 10:27 PM   #4
leosgb
Member
 
Registered: Nov 2004
Location: Brazil
Distribution: Gentoo
Posts: 363

Original Poster
Rep: Reputation: 31
I tried using xvid codec and got: 105.500.906 (with 150x100). So I guess one of the ways is to find the best codec. Is it possible to make it go thru the codec several times to improve the compression?
 
Old 06-07-2007, 12:56 PM   #5
dawkcid
Member
 
Registered: May 2007
Location: UK
Distribution: LFS,Slackware,Slamd64,NetBSD
Posts: 102

Rep: Reputation: 15
Finding the best quality vs size is, unfortunately, not an exact science. You'll just need to experiment a little. Be sure to read the mplayer man page carefully, there are LOTS of options to tweak mencoder. You should also read the mencoder documentation (should be at /usr/share/doc/MPlayer-(version)/html/mencoder.html) for encoding tips. By the way, the biggest factor in file size (and quality) is not the resolution, but the video bitrate.
 
Old 06-07-2007, 02:10 PM   #6
leosgb
Member
 
Registered: Nov 2004
Location: Brazil
Distribution: Gentoo
Posts: 363

Original Poster
Rep: Reputation: 31
I see, but shouldnt I get a much smaller file if I have much smaller frames? That is assuming I dont touch the bitrate, after all if each frame has a given number of bits and I keep the bitrate but transfer less bits I would expect a smaller file. Feel free to correct me if I am wrong.

I will try it again with xvid codec. And will also play around with the bitrate. Can mencoder be smart and notice that I am reducing the screen resolution but since I dont state anything about bitrate it increases my bitrate "automagically"?

I will post back my results once I get some numbers to compare.

Thanks for your tips!
 
Old 06-08-2007, 08:36 AM   #7
dawkcid
Member
 
Registered: May 2007
Location: UK
Distribution: LFS,Slackware,Slamd64,NetBSD
Posts: 102

Rep: Reputation: 15
The bitrate is the number of bits (or kilobits) _per second_, not _per frame_, you still have the same number of frames per second. If you have the same bitrate but reduce the resolution, you just increase the number of bits used per frame compared to a higher resolution.

Quote:
Can mencoder be smart and notice that I am reducing the screen resolution but since I dont state anything about bitrate it increases my bitrate "automagically"?
Not that I've noticed. If you don't specify a bitrate it will just use some default value, which seems to be the same regardless of resolution. AFICT anyway.

Also, I forgot to mention /usr/doc/MPlayer-(version)/tech/encoding-tips.txt. There are some good tips in here, I improved the quality of my encodings dramatically by using some of these suggestions. Especially, you should always use vhq or mbd=1 (same thing) or maybe mbd=2. The default is mbd=0, if you use this you probably want to change the mbcmp option to something other than 0 (see mplayer man page for details).

Last edited by dawkcid; 06-08-2007 at 08:39 AM.
 
Old 06-11-2007, 06:51 PM   #8
DiBosco
Member
 
Registered: Nov 2001
Location: Manchester, UK
Distribution: Mageia
Posts: 813

Rep: Reputation: 40
Would acidrip help with this? I think it might be worth having a play with it anyway...
 
Old 06-14-2007, 10:38 AM   #9
dawkcid
Member
 
Registered: May 2007
Location: UK
Distribution: LFS,Slackware,Slamd64,NetBSD
Posts: 102

Rep: Reputation: 15
I don't think it will help in this case. Acidrip is for ripping dvds, not sure it can encode from files. It's just a frontend to mplayer/mencoder anyway.
 
Old 06-15-2007, 12:43 PM   #10
DiBosco
Member
 
Registered: Nov 2001
Location: Manchester, UK
Distribution: Mageia
Posts: 813

Rep: Reputation: 40
I've used acidrip for converting MPEG files (of programmes I've backed up from my Sky+ box) to AVIs, so it's definitely not just for ripping DVDs. It looks to me like you can choose crop and scale options, so it might be worth playing about with. I appreciate it's just a front end for other command line programs; can memcoder definitely not do what you're after?
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
any ideas to reduce log file size or make log file size managed? George2 Programming 2 08-13-2006 06:55 AM
How to reduce voice-audio file size? WindowBreaker Slackware 9 02-04-2006 09:09 AM
How to reduce the size of root / alexf SUSE / openSUSE 5 10-10-2005 04:53 PM
help me reduce my OS size =/ xushi Slackware 29 12-01-2004 11:45 AM
How to reduce the size of bzImage hemk76 Linux - Networking 2 10-05-2004 06:32 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:54 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration