LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-07-2006, 08:28 PM   #1
calande
Member
 
Registered: Oct 2005
Distribution: Ubuntu
Posts: 165

Rep: Reputation: 15
How to resize and compress an MEPG for the web?


I was given a large MPEG movie of 10 mins that I have to resize to 300x200px and to compress more so that it's not more than 2-3MB. How could I do that on Linux?
Thanks,
 
Old 12-07-2006, 10:30 PM   #2
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
There are many programs, most of them cli, that can be used for video processing. Mencoder and transcode are two of the most popular. But for this purpose I think ffmpeg is the fastest and easiest.

'ffmpeg -i inputvid.mpg -b 500 -s 300x200 -acodec mp3 -ab 64 outputvid.mpg'

...will convert the video to 300x200 with a bitrate of 500kbs, and convert the audio to 64kbs mp3. Feel free to play around with bitrate settings until you get the size and quality you want.
 
Old 12-09-2006, 03:46 PM   #3
calande
Member
 
Registered: Oct 2005
Distribution: Ubuntu
Posts: 165

Original Poster
Rep: Reputation: 15
Thank you David, here's what I get:

Code:
# ffmpeg -i 'Abertura-depoimentos(16m19s).mpg' -b 500 -s 300x200 -acodec mp3 -ab 64 movie.mpeg
ffmpeg version 0.4.9-pre1, build 4718, Copyright (c) 2000-2004 Fabrice Bellard
  built on Mar 16 2006 00:51:40, gcc: 3.4.4 [FreeBSD] 20050518
Input #0, mpeg, from 'Abertura-depoimentos(16m19s).mpg':
  Duration: 00:16:17.7, bitrate: 1393 kb/s
  Stream #0.0: Video: mpeg1video, 352x240, 29.97 fps
  Stream #0.1: Audio: mp2, 44100 Hz, stereo, 224 kb/s
File 'movie.mpeg' already exists. Overwrite ? [y/N] y
Output #0, mpeg, to 'movie.mpeg':
  Stream #0.0: Video: mpeg1video, 300x200, 29.97 fps, q=2-31, 500 kb/s
  Stream #0.1: Audio: 0x0000, 44100 Hz, stereo, 64 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #0.1 -> #0.1
Unsupported codec for output stream #0.1
Any idea?
 
Old 12-09-2006, 03:49 PM   #4
Daws
Member
 
Registered: May 2006
Location: UK
Distribution: Debian
Posts: 447

Rep: Reputation: 39
Hello, try installing lame
 
Old 12-09-2006, 05:03 PM   #5
calande
Member
 
Registered: Oct 2005
Distribution: Ubuntu
Posts: 165

Original Poster
Rep: Reputation: 15
Thanks, lame is already installed on my computer (I double-checked). Am I missing something?
 
Old 12-09-2006, 05:17 PM   #6
Daws
Member
 
Registered: May 2006
Location: UK
Distribution: Debian
Posts: 447

Rep: Reputation: 39
Ah. Ok then, you may have to recompile ffmpeg to use lame, adding "--enable-mp3lame" when configuring. But I don't do alot of video editing so there is probably an easier solution available.

Hope you get it sorted
 
Old 12-10-2006, 06:12 AM   #7
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
You could also change the codec to mp2 or perhaps even ac3 instead. I only chose mp3 because it provides the best sound for low compression levels, since file size is important to you.

'ffmpeg -formats' will tell you what your version of ffmpeg is capable of handling.
 
Old 12-10-2006, 03:08 PM   #8
calande
Member
 
Registered: Oct 2005
Distribution: Ubuntu
Posts: 165

Original Poster
Rep: Reputation: 15
Thank you. It seems I have mp3 support for encoding:

Code:
# ffmpeg -formats
ffmpeg version 0.4.9-pre1, build 4718, Copyright (c) 2000-2004 Fabrice Bellard
  built on Mar 16 2006 00:51:40, gcc: 3.4.4 [FreeBSD] 20050518
File formats:
  E 3gp
 D  4xm
 D  RoQ
 DE ac3
 DE alaw
 DE asf
  E asf_stream
 DE au
 DE audio_device
 DE avi
  E crc
 DE dv
 DE ffm
 D  film_cpk
 D  flic
 DE flv
 DE gif
 D  h261
 DE h263
 DE h264
 D  idcin
 DE image
 DE imagepipe
 D  ipmovie
 DE m4v
 D  matroska
 DE mjpeg
  E mov
 D  mov,mp4,m4a,3gp
  E mp2
 D  mp3
  E mp4
 DE mpeg
  E mpeg1video
 DE mpegts
 D  mpegvideo
  E mpjpeg
 DE mulaw
  E null
 DE nut
 D  psxstr
 DE rawvideo
 D  redir
 DE rm
  E rtp
 D  rtsp
 DE s16be
 DE s16le
 DE s8
 D  sdp
  E singlejpeg
  E svcd
 DE swf
 DE u16be
 DE u16le
 DE u8
  E vcd
 D  video4linux
 D  vmd
  E vob
 DE wav
 D  wc3movie
 D  wsaud
 D  wsvqa
 DE yuv4mpegpipe

Image formats:
 D  pnm
  E pbm
  E pgm
  E ppm
 DE pam
 DE pgmyuv
 DE yuv
 DE png
 DE jpeg
 DE gif
 DE sgi

Codecs:
 D V    4xm
 D V D  8bps
 DEA    ac3
 DEA    adpcm_4xm
 DEA    adpcm_adx
 DEA    adpcm_ea
 DEA    adpcm_ima_dk3
 DEA    adpcm_ima_dk4
 DEA    adpcm_ima_qt
 DEA    adpcm_ima_smjpeg
 DEA    adpcm_ima_wav
 DEA    adpcm_ima_ws
 DEA    adpcm_ms
 DEA    adpcm_xa
 DEV D  asv1
 DEV D  asv2
 D V D  cinepak
 D V D  cljr
 D V D  cyuv
 DEV D  dvvideo
 DEV D  ffv1
 D A    flac
 D V D  flic
 DEVSD  flv
 DEA    g726
 D V  T h261
 DEVSDT h263
 D VSD  h263i
  EV    h263p
 D V DT h264
 DEVSD  huffyuv
 D V D  idcinvideo
 D V    indeo3
 D A    interplay_dpcm
 D V D  interplayvideo
  EV    ljpeg
 D A    mace3
 D A    mace6
 D V D  mdec
 DEV D  mjpeg
 D V D  mjpegb
 DEA    mp2
 D A    mp3
 DEVSDT mpeg1video
 DEVSDT mpeg2video
 DEVSDT mpeg4
 D VSDT mpegvideo
 DEVSD  msmpeg4
 DEVSD  msmpeg4v1
 DEVSD  msmpeg4v2
 D V D  msrle
 D V D  msvideo1
 D V D  mszh
 DEA    pcm_alaw
 DEA    pcm_mulaw
 DEA    pcm_s16be
 DEA    pcm_s16le
 DEA    pcm_s8
 DEA    pcm_u16be
 DEA    pcm_u16le
 DEA    pcm_u8
 D V D  qtrle
 DEV    rawvideo
 D A    real_144
 D A    real_288
 D A    roq_dpcm
 D V D  roqvideo
 D V D  rpza
 DEV D  rv10
 D V D  rv20
 D V D  smc
 D V D  sp5x
 DEV D  svq1
 D VSD  svq3
 D V    theora
 D V D  truemotion1
 D V D  vcr1
 D A    vmdaudio
 D V D  vmdvideo
 D V    vp3
 D V D  vqavideo
 D A    wmav1
 D A    wmav2
 DEVSD  wmv1
 DEVSD  wmv2
 D A    xan_dpcm
 D V D  xan_wc3
 DEV D  zlib

Supported file protocols:
 file: pipe: udp: rtp: tcp: http:
Frame size, frame rate abbreviations:
 ntsc pal qntsc qpal sntsc spal film ntsc-film sqcif qcif cif 4cif
Motion estimation methods:
 zero(fastest) full(slowest) log phods epzs(default) x1

Note, the names of encoders and decoders dont always match, so there are
several cases where the above table shows encoder only or decoder only entries
even though both encoding and decoding are supported for example, the h263
decoder corresponds to the h263 and h263p encoders, for file formats its even
worse
#
But whatever format I choose, I get the same error message:

Code:
# ffmpeg -i 'Abertura-depoimentos(16m19s).mpg' -b 500 -s 300x200 -acodec wmav1 -ab 64 movie.mpeg
ffmpeg version 0.4.9-pre1, build 4718, Copyright (c) 2000-2004 Fabrice Bellard
  built on Mar 16 2006 00:51:40, gcc: 3.4.4 [FreeBSD] 20050518
Input #0, mpeg, from 'Abertura-depoimentos(16m19s).mpg':
  Duration: 00:16:17.7, bitrate: 1393 kb/s
  Stream #0.0: Video: mpeg1video, 352x240, 29.97 fps
  Stream #0.1: Audio: mp2, 44100 Hz, stereo, 224 kb/s
File 'movie.mpeg' already exists. Overwrite ? [y/N] y
Output #0, mpeg, to 'movie.mpeg':
  Stream #0.0: Video: mpeg1video, 300x200, 29.97 fps, q=2-31, 500 kb/s
  Stream #0.1: Audio: 0x0000, 44100 Hz, stereo, 64 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #0.1 -> #0.1
Unsupported codec for output stream #0.1
#
 
Old 12-10-2006, 03:11 PM   #9
calande
Member
 
Registered: Oct 2005
Distribution: Ubuntu
Posts: 165

Original Poster
Rep: Reputation: 15
Ok, AC3 worked!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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



Similar Threads
Thread Thread Starter Forum Replies Last Post
LVM Resize - After logical resize, FS size does not match physical size. spectra Linux - Software 6 11-01-2006 11:28 AM
File Compress malru AIX 2 06-17-2006 09:40 PM
Compress Gins Linux - General 5 11-19-2004 01:05 PM
compress fs alaios Linux - General 5 09-07-2004 08:29 PM
compress Ownasaurus Linux - Software 4 09-12-2003 07:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:12 PM.

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