Reducing a video in file size

Hi All, I've got a 3.9 GB video file that I want to reduce significantly in size. I noticed the Nautilus >> Properties >> Audio/Video Properties on this file said the resolution was 1920 by 1080. So I searched the web and found the suggestion to use mencoder -- which was already installed in my system. Set the resolution to 960 x 540 and expected an output file of a bit more than 1/4 of the original file size. Quite surprised to see that the output increased in size to 4.8 GB! Any hints on how I can resize the resulting file down to about a quarter of the original? I've got AVIDemux, GStreamer plugins and codecs, movieplayer, smplayer, pitivi, transmageddon, VLC media player, and apparently mencoder. Thanks a lot, Carl Bayswater Here's the command I gave:
mencoder TWYDS1.mkv -vf scale=960:540 -oac pcm -ovc copy -o TWYDS2.mkv
Here's the resulting output:
MEncoder SVN-r1.0~rc3+svn20090426-4.4.3 (C) 2000-2009 MPlayer Team
WARNING: OUTPUT FILE FORMAT IS _AVI_. See -of help. success: format: 0 data: 0x0 - 0xf6de8583 [mkv] Track ID 1: video (V_MPEG4/ISO/AVC), -vid 0 [mkv] Track ID 2: audio (A_AAC), -aid 0, -alang eng [mkv] Will play video track 1. Matroska file format detected. VIDEO: [avc1] 1920x1080 24bpp 25.000 fps 0.0 kbps ( 0.0 kbyte/s) [V] filefmt:31 fourcc:0x31637661 size:1920x1080 fps:25.000 ftime:=0.0400 ========================================================================== Opening audio decoder: [faad] AAC (MPEG2/4 Advanced Audio Coding) FAAD: compressed input bitrate missing, assuming 128kbit/s! AUDIO: 48000 Hz, 2 ch, s16le, 128.0 kbit/8.33% (ratio: 16000->192000) Selected audio codec: [faad] afm: faad (FAAD AAC (MPEG-2/MPEG-4 Audio)) ========================================================================== videocodec: framecopy (1920x1080 24bpp fourcc=31637661) Writing header... ODML: Aspect information not (yet?) available or unspecified, not writing vprp header. Writing header... ODML: Aspect information not (yet?) available or unspecified, not writing vprp header. Pos: 1.4s 35f ( 0%) 0.00fps Trem: 0min 0mb A-V:0.080 [152:1536] Skipping frame! ODML: Starting new RIFF chunk at 1023MB.: 3min 4834mb A-V:0.042 [6154:1536]] ODML: Starting new RIFF chunk at 2047MB.: 2min 4881mb A-V:0.043 [5848:1536] Pos:3390.6s 84765f (61%) 462.47fps Trem: 1min 4871mb A-V:0.080 [5901:1536] Skipping frame! ODML: Starting new RIFF chunk at 3071MB.: 1min 4870mb A-V:0.043 [5913:1536] ODML: Starting new RIFF chunk at 4095MB.: 0min 4899mb A-V:0.028 [5732:1536] Writing index...97f (99%) 474.61fps Trem: 0min 4925mb A-V:0.024 [5575:1536] Writing header... ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.
Video stream: 5575.664 kbit/s (696957 B/s) size: 4047792233 bytes 5807.800 secs 145197 frames
Audio stream: 1536.000 kbit/s (192000 B/s) size: 1114841088 bytes 5806.464 secs

Don't you need to pass in some quality parameters for the codec? Also, I'd use avconv rather than mencoder myself. Try something like: avconv -i input.mkv -filter scale=960:540 -codec:a ac3 -b:a 192k -codec:v libx264 -profile:v high -crf 22 output.mkv But play with the -crf parameter to change quality level. You can also specific min and max bitrates. T On 24 February 2014 13:09, Carl Turney <carl@boms.com.au> wrote:
Hi All,
I've got a 3.9 GB video file that I want to reduce significantly in size.
I noticed the Nautilus >> Properties >> Audio/Video Properties on this file said the resolution was 1920 by 1080.
So I searched the web and found the suggestion to use mencoder -- which was already installed in my system.
Set the resolution to 960 x 540 and expected an output file of a bit more than 1/4 of the original file size.
Quite surprised to see that the output increased in size to 4.8 GB!
Any hints on how I can resize the resulting file down to about a quarter of the original?
I've got AVIDemux, GStreamer plugins and codecs, movieplayer, smplayer, pitivi, transmageddon, VLC media player, and apparently mencoder.
Thanks a lot,
Carl Bayswater
Here's the command I gave:
mencoder TWYDS1.mkv -vf scale=960:540 -oac pcm -ovc copy -o TWYDS2.mkv
Here's the resulting output:
MEncoder SVN-r1.0~rc3+svn20090426-4.4.3 (C) 2000-2009 MPlayer Team
WARNING: OUTPUT FILE FORMAT IS _AVI_. See -of help. success: format: 0 data: 0x0 - 0xf6de8583 [mkv] Track ID 1: video (V_MPEG4/ISO/AVC), -vid 0 [mkv] Track ID 2: audio (A_AAC), -aid 0, -alang eng [mkv] Will play video track 1. Matroska file format detected. VIDEO: [avc1] 1920x1080 24bpp 25.000 fps 0.0 kbps ( 0.0 kbyte/s) [V] filefmt:31 fourcc:0x31637661 size:1920x1080 fps:25.000 ftime:=0.0400 ========================================================================== Opening audio decoder: [faad] AAC (MPEG2/4 Advanced Audio Coding) FAAD: compressed input bitrate missing, assuming 128kbit/s! AUDIO: 48000 Hz, 2 ch, s16le, 128.0 kbit/8.33% (ratio: 16000->192000) Selected audio codec: [faad] afm: faad (FAAD AAC (MPEG-2/MPEG-4 Audio)) ========================================================================== videocodec: framecopy (1920x1080 24bpp fourcc=31637661) Writing header... ODML: Aspect information not (yet?) available or unspecified, not writing vprp header. Writing header... ODML: Aspect information not (yet?) available or unspecified, not writing vprp header. Pos: 1.4s 35f ( 0%) 0.00fps Trem: 0min 0mb A-V:0.080 [152:1536] Skipping frame! ODML: Starting new RIFF chunk at 1023MB.: 3min 4834mb A-V:0.042 [6154:1536]] ODML: Starting new RIFF chunk at 2047MB.: 2min 4881mb A-V:0.043 [5848:1536] Pos:3390.6s 84765f (61%) 462.47fps Trem: 1min 4871mb A-V:0.080 [5901:1536] Skipping frame! ODML: Starting new RIFF chunk at 3071MB.: 1min 4870mb A-V:0.043 [5913:1536] ODML: Starting new RIFF chunk at 4095MB.: 0min 4899mb A-V:0.028 [5732:1536] Writing index...97f (99%) 474.61fps Trem: 0min 4925mb A-V:0.024 [5575:1536] Writing header... ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.
Video stream: 5575.664 kbit/s (696957 B/s) size: 4047792233 bytes 5807.800 secs 145197 frames
Audio stream: 1536.000 kbit/s (192000 B/s) size: 1114841088 bytes 5806.464 secs
luv-main mailing list luv-main@luv.asn.au http://lists.luv.asn.au/listinfo/luv-main
-- Turning and turning in the widening gyre The falcon cannot hear the falconer Things fall apart; the center cannot hold Mere anarchy is loosed upon the world

Hi All, Toby, thanks for that suggestion (below). However... Would like to try aconv, but don't have it installed. Tried searching for it using Synaptic Package Manager, and found nothing. Have got lots of repositories added to my system, including all the ones recommended by MediBuntu. Am running Ubuntu 10.4 (Lucid). Yeah, yeah. Not running the latest version. (Will do a complete system rebuild after 14.4 gets to the 14.4.1 stage in July(?). Not looking forward to re-tweaking every setting on every application, and re-installing every codec and neat little extra utility.) In the mean time, anyone else have suggestions to my original post? Thanks very much. Carl On 24/02/14 16:04, Toby Corkindale wrote:
Don't you need to pass in some quality parameters for the codec?
Also, I'd use avconv rather than mencoder myself.
Try something like: avconv -i input.mkv -filter scale=960:540 -codec:a ac3 -b:a 192k -codec:v libx264 -profile:v high -crf 22 output.mkv
But play with the -crf parameter to change quality level. You can also specific min and max bitrates.
T
On 24 February 2014 13:09, Carl Turney <carl@boms.com.au> wrote:
Hi All,
I've got a 3.9 GB video file that I want to reduce significantly in size.
I noticed the Nautilus >> Properties >> Audio/Video Properties on this file said the resolution was 1920 by 1080.
So I searched the web and found the suggestion to use mencoder -- which was already installed in my system.
Set the resolution to 960 x 540 and expected an output file of a bit more than 1/4 of the original file size.
Quite surprised to see that the output increased in size to 4.8 GB!
Any hints on how I can resize the resulting file down to about a quarter of the original?
I've got AVIDemux, GStreamer plugins and codecs, movieplayer, smplayer, pitivi, transmageddon, VLC media player, and apparently mencoder.
Thanks a lot,
Carl Bayswater
Here's the command I gave:
mencoder TWYDS1.mkv -vf scale=960:540 -oac pcm -ovc copy -o TWYDS2.mkv
Here's the resulting output:
MEncoder SVN-r1.0~rc3+svn20090426-4.4.3 (C) 2000-2009 MPlayer Team
WARNING: OUTPUT FILE FORMAT IS _AVI_. See -of help. success: format: 0 data: 0x0 - 0xf6de8583 [mkv] Track ID 1: video (V_MPEG4/ISO/AVC), -vid 0 [mkv] Track ID 2: audio (A_AAC), -aid 0, -alang eng [mkv] Will play video track 1. Matroska file format detected. VIDEO: [avc1] 1920x1080 24bpp 25.000 fps 0.0 kbps ( 0.0 kbyte/s) [V] filefmt:31 fourcc:0x31637661 size:1920x1080 fps:25.000 ftime:=0.0400 ========================================================================== Opening audio decoder: [faad] AAC (MPEG2/4 Advanced Audio Coding) FAAD: compressed input bitrate missing, assuming 128kbit/s! AUDIO: 48000 Hz, 2 ch, s16le, 128.0 kbit/8.33% (ratio: 16000->192000) Selected audio codec: [faad] afm: faad (FAAD AAC (MPEG-2/MPEG-4 Audio)) ========================================================================== videocodec: framecopy (1920x1080 24bpp fourcc=31637661) Writing header... ODML: Aspect information not (yet?) available or unspecified, not writing vprp header. Writing header... ODML: Aspect information not (yet?) available or unspecified, not writing vprp header. Pos: 1.4s 35f ( 0%) 0.00fps Trem: 0min 0mb A-V:0.080 [152:1536] Skipping frame! ODML: Starting new RIFF chunk at 1023MB.: 3min 4834mb A-V:0.042 [6154:1536]] ODML: Starting new RIFF chunk at 2047MB.: 2min 4881mb A-V:0.043 [5848:1536] Pos:3390.6s 84765f (61%) 462.47fps Trem: 1min 4871mb A-V:0.080 [5901:1536] Skipping frame! ODML: Starting new RIFF chunk at 3071MB.: 1min 4870mb A-V:0.043 [5913:1536] ODML: Starting new RIFF chunk at 4095MB.: 0min 4899mb A-V:0.028 [5732:1536] Writing index...97f (99%) 474.61fps Trem: 0min 4925mb A-V:0.024 [5575:1536] Writing header... ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.
Video stream: 5575.664 kbit/s (696957 B/s) size: 4047792233 bytes 5807.800 secs 145197 frames
Audio stream: 1536.000 kbit/s (192000 B/s) size: 1114841088 bytes 5806.464 secs
luv-main mailing list luv-main@luv.asn.au http://lists.luv.asn.au/listinfo/luv-main

On 26/02/14 09:42, Carl Turney wrote:
Hi All,
Toby, thanks for that suggestion (below). However...
Would like to try aconv, but don't have it installed. Tried searching for it using Synaptic Package Manager, and found nothing. Have got lots of repositories added to my system, including all the ones recommended by MediBuntu.
That is possibly because avconv is but one binary in the libav suite. Look at libav.org, or do git clone git://git.libav.org/libav.git libav or get one of the tar'd releases and compile it.

On 26 February 2014 13:05, Allan Duncan <amd2345@fastmail.com.au> wrote:
On 26/02/14 09:42, Carl Turney wrote:
Hi All,
Toby, thanks for that suggestion (below). However...
Would like to try aconv, but don't have it installed. Tried searching for it using Synaptic Package Manager, and found nothing. Have got lots of repositories added to my system, including all the ones recommended by MediBuntu.
That is possibly because avconv is but one binary in the libav suite. Look at libav.org, or do git clone git://git.libav.org/libav.git libav or get one of the tar'd releases and compile it.
On Ubuntu, avconv is packaged inside the libav-tools package. Although I don't know if you'll have that on a four-year-old distribution.. might be in backports somewhere?

To answer your original query about the file expansion I think you have just copied the video and expanded the audio to pcm (e..g WAV or CD format) which is many times (10x?) larger than say mp3. See the " -oac pcm -ovc copy" part of your command. I think -oac -> output audio codec is set to pcm and -ovc -> output video codec is copy (just copies it). Hence the Video is not shrunk and the audio is blown up massively... You have to be careful what codecs you put into the container as some players won't accept strange combinations. I don't know if you will end up with an .avi with a .mkv file suffix or not either... On the bright side perhaps this will help? Here are some old shell functions that use mencoder to do 1 pass and 2 pass (better quality with 2 passes). May be it's useful for you or others? I haven't really tested them lately so make a copy and try it out on that. It uses old (but widely supported now) DiVx codec and mp3 so I am sure there are much more powerful options available now, Note $1 => first argument in a shell function. Save them into a file like vid.sh and source it and use it as follows: . ./vid.sh 1passEncode <VideoRate> <AudioRate> <File> To do a 1 pass encode at given video rate/ audio rate on to a file (output is movie.avi) To do the slower but better quality encoding try the two pass.: 2passEncode 858 96 video.avi will generate an encoding a video bit rate of 858 . audio (mp3) at 96 on existing file video.avi and into newvideo.avi. be aware it uses temporary file move.avi to work on... There are also another that just does video and one that allows the size to be shrunk. ------------------- Cut below here and place into a file e.g. vid.sh ----------- # Perform the 1pass encoding based on the given video code rating function 1passEncode () { BitRate=$1 AUBR=$2 IFile=$3 L0=-lavcopts L1=mp3lame L2=-lameopts L3="vbr=3:br=$AUBR" MD="-ffourcc" Codec="vcodec=mpeg4:vhq:vbitrate=$BitRate" Pass1Args=${Codec} echo rm -f frameno.avi lavc_stats.txt divx2pass.log rm -f frameno.avi lavc_stats.txt divx2pass.log echo mencoder $MD DIVX -ovc lavc $L0 $Pass1Args -oac $L1 $L2 $L3 -o movie.avi $IFile mencoder $MD DIVX -ovc lavc $L0 $Pass1Args -oac $L1 $L2 $L3 -o movie.avi $IFile } # 1pass Video only encode (copy audio) function 1passVideoEncode () { IFile=$1 BitRate=${2:-2000} L0=-lavcopts MD="-ffourcc" Codec="vcodec=mpeg4:vhq:vbitrate=$BitRate" Pass1Args=${Codec} echo rm -f frameno.avi lavc_stats.txt divx2pass.log rm -f frameno.avi lavc_stats.txt divx2pass.log echo mencoder $MD DIVX -ovc lavc $L0 $Pass1Args -oac copy -o movie.avi $IFile mencoder $MD DIVX -ovc lavc $L0 $Pass1Args -oac copy -o movie.avi $IFile } # Perform the 2pass encoding based on the given video code rating function 2passEncode () { BitRate=$1 AUBR=$2 IFile=$3 CC=${4:-"XVID"} L0=-lavcopts L1=mp3lame L2=-lameopts L3="vbr=3:br=$AUBR" L4="-ffourcc" Codec="autoaspect:vcodec=mpeg4:vhq:vbitrate=$BitRate:vpass=" Pass1Args=${Codec}1 Pass2Args=${Codec}2 echo rm -f frameno.avi lavc_stats.txt divx2pass.log rm -f frameno.avi lavc_stats.txt divx2pass.log echo mencoder -ovc lavc $L0 $Pass1Args -oac $L1 $L2 $L3 -o movie.avi $IFile $L4 $CC $5 $6 mencoder -ovc lavc $L0 $Pass1Args -oac $L1 $L2 $L3 -o movie.avi $IFile $L4 $CC $5 $6 echo mencoder -ovc lavc $L0 $Pass2Args -oac $L1 $L2 $L3 -o movie.avi $IFile $L4 $CC $5 $6 mencoder -ovc lavc $L0 $Pass2Args -oac $L1 $L2 $L3 -o movie.avi $IFile $L4 $CC $5 $6 echo mv movie.avi new$IFile mv movie.avi new$IFile } # Perform the 2pass encoding Video only! function 2passEncodeVideo () { BitRate=$1 #AUBR=$2 IFile=$2 L0=-lavcopts L1=copy #L2=-lameopts #L3="vbr=3:br=$AUBR" Codec="autoaspect:vcodec=mpeg4:vhq:vbitrate=$BitRate:vpass=" Pass1Args=${Codec}1 Pass2Args=${Codec}2 echo rm -f frameno.avi lavc_stats.txt divx2pass.log rm -f frameno.avi lavc_stats.txt divx2pass.log echo mencoder -ovc lavc $L0 $Pass1Args -oac $L1 -o movie.avi $IFile $4 $5 $6 mencoder -ovc lavc $L0 $Pass1Args -oac $L1 -o movie.avi $IFile $4 $5 $6 echo mencoder -ovc lavc $L0 $Pass2Args -oac $L1 -o movie.avi $IFile $4 $5 $6 mencoder -ovc lavc $L0 $Pass2Args -oac $L1 -o movie.avi $IFile $4 $5 $6 echo mv movie.avi new$IFile mv movie.avi new$IFile } # Perform the 2pass encoding and rescale based on the given video code rating function 2passShrinkEncode () { Width=$1 Height=$2 BitRate=$3 AUBR=$4 IFile=$5 L0=-lavcopts L1=mp3lame L2=-lameopts L3="vbr=3:br=$AUBR" L4="-vop" L5="scale=$Width:$Height" # Added autoaspect Codec="autoaspect:vcodec=mpeg4:vhq:vbitrate=$BitRate:vpass=" Pass1Args=${Codec}1 Pass2Args=${Codec}2 echo rm -f frameno.avi lavc_stats.txt divx2pass.log rm -f frameno.avi lavc_stats.txt divx2pass.log echo mencoder -ovc lavc $L0 $Pass1Args -oac $L1 $L2 $L3 $L4 $L5 -o movie.avi $IFile mencoder -ovc lavc $L0 $Pass1Args -oac $L1 $L2 $L3 $L4 $L5 -o movie.avi $IFile echo mencoder -ovc lavc $L0 $Pass2Args -oac $L1 $L2 $L3 $L4 $L5 -o movie.avi $IFile mencoder -ovc lavc $L0 $Pass2Args -oac $L1 $L2 $L3 $L4 $L5 -o movie.avi $IFile } On 26 February 2014 16:14, Toby Corkindale <toby@dryft.net> wrote:
On 26 February 2014 13:05, Allan Duncan <amd2345@fastmail.com.au> wrote:
On 26/02/14 09:42, Carl Turney wrote:
Hi All,
Toby, thanks for that suggestion (below). However...
Would like to try aconv, but don't have it installed. Tried searching for it using Synaptic Package Manager, and found nothing. Have got lots of repositories added to my system, including all the ones recommended by MediBuntu.
That is possibly because avconv is but one binary in the libav suite. Look at libav.org, or do git clone git://git.libav.org/libav.git libav or get one of the tar'd releases and compile it.
On Ubuntu, avconv is packaged inside the libav-tools package. Although I don't know if you'll have that on a four-year-old distribution.. might be in backports somewhere? _______________________________________________ luv-main mailing list luv-main@luv.asn.au http://lists.luv.asn.au/listinfo/luv-main

On Mon, 24 Feb 2014 13:09:10 Carl Turney wrote:
I've got a 3.9 GB video file that I want to reduce significantly in size.
I noticed the Nautilus >> Properties >> Audio/Video Properties on this file said the resolution was 1920 by 1080.
So I searched the web and found the suggestion to use mencoder -- which was already installed in my system.
Set the resolution to 960 x 540 and expected an output file of a bit more than 1/4 of the original file size.
Quite surprised to see that the output increased in size to 4.8 GB!
Any hints on how I can resize the resulting file down to about a quarter of the original?
http://etbe.coker.com.au/2013/02/15/conversion-video-files/ The above blog post documents what I was doing in this regard early last year. Since then I've tweaked my Makefile a bit and am using the -b option and a similar option to set the audio bitrate. When I'm at home I'll look at my latest scripts and see if it's worth another blog post, if not I'll just attach my Makefile to this list. -- My Main Blog http://etbe.coker.com.au/ My Documents Blog http://doc.coker.com.au/

Hi All, Russell, thanks much for this post (below). Unfortunately, had a look at that link, and it's way over my head. Can only assume that the code at that link should be copied and saved as a shell script file, then executed? May try the easier-to-understand single-line suggestion from Toby in this thread. Any user-level mailing lists in LUV? Have forgotten way too much about computing and Linux, over the past decade and a half. Cheers, Carl On 24/02/14 17:24, Russell Coker wrote:
On Mon, 24 Feb 2014 13:09:10 Carl Turney wrote:
I've got a 3.9 GB video file that I want to reduce significantly in size.
I noticed the Nautilus >> Properties >> Audio/Video Properties on this file said the resolution was 1920 by 1080.
So I searched the web and found the suggestion to use mencoder -- which was already installed in my system.
Set the resolution to 960 x 540 and expected an output file of a bit more than 1/4 of the original file size.
Quite surprised to see that the output increased in size to 4.8 GB!
Any hints on how I can resize the resulting file down to about a quarter of the original?
http://etbe.coker.com.au/2013/02/15/conversion-video-files/
The above blog post documents what I was doing in this regard early last year. Since then I've tweaked my Makefile a bit and am using the -b option and a similar option to set the audio bitrate. When I'm at home I'll look at my latest scripts and see if it's worth another blog post, if not I'll just attach my Makefile to this list.

On Wed, 26 Feb 2014, Carl Turney <carl@boms.com.au> wrote:
Russell, thanks much for this post (below).
Unfortunately, had a look at that link, and it's way over my head.
Can only assume that the code at that link should be copied and saved as a shell script file, then executed?
The main file is a Makefile, it calls a bash shell script (the part starting with #!/bin/bash) to do some of it's work. The purpose of a Makefile is to run commands to compile things when the source is newer or when the object is missing. When it's setup correctly you just type "make" to get the desired result. -- My Main Blog http://etbe.coker.com.au/ My Documents Blog http://doc.coker.com.au/
participants (5)
-
Allan Duncan
-
Andrew Worsley
-
Carl Turney
-
Russell Coker
-
Toby Corkindale