x
This website is using cookies. We use cookies to ensure that we give you the best experience on our website. More info. That's Fine
HPC:Factor Logo 
 
Latest Forum Activity

Converting video to a mobile format - file size

1 2
chazco
chazco Page Icon Posted 2006-08-04 9:05 AM
#
Status:
Hi,

I've been converting video to a format my PPC can play. I've been doing this on Linux. The command i've been using is:
Quote

ffmpeg -i input.avi -s 320x240 -g 15 -r 15 -vcodec msmpeg4 -vtag div3 output.avi


The -s value is the resolution and needs to be fullscreen. The video codec and tags are just telling it to use divx.

However, the file size seems a little larger than it should be. Can anyone suggest how to reduce the file size?



Edited by chazco 2006-08-04 9:06 AM
 Top of the page
C:Amie Page Icon Posted 2006-08-04 9:52 AM
#
Avatar image of C:Amie
Administrator
H/PC Oracle

Posts:
18,002
Location:
United Kingdom
Status:
You could alter the bitrate. In your sample command-argument above you are telling it to use 200Kbps you could alter that to something considerably lower and keep the video output reasonable. The command argument is -b. You also are not optimising the audio stream, you can likewuse adjust the audio bitrate using -ab, -ac sets the number of channels (default is mono) and the audio codec, unsurprisingly -acodec AAC or MPEG.
 Top of the page
BrianD
BrianD Page Icon Posted 2006-08-04 10:02 AM
#
Status:
If it is a "little" larger than it should be, maybe it could be enough to decrease audio sample rate & bitrate. You could try 24 kHz & 64 kbps. I think you cannot hear much difference on a PPC/HPC.
 Top of the page
PocketDVD Page Icon Posted 2006-08-04 10:39 AM
#
Avatar image of PocketDVD
H/PC Philosopher

Posts:
363
Location:
Canada
Status:
The official documentation of FFMPEG
http://ffmpeg.mplayerhq.hu/ffmpeg-doc.html


your commandline : ffmpeg -i input.avi -s 320x240 -g 15 -r 15 -vcodec msmpeg4 -vtag div3 output.avi will work on TCPMP, but I wouldnt use this one. You are using the Microsoft AVI format, which isnt that good a quality. This results in files that play normally without any additional codecs on a desktops computer's Windows Media Player, but the Media Player on your device can ONLY play WMA, MP# audio files and WMV video files. It does not handle avi files.

FFMPEG can create video files that use the WMV format, but unfortunately there is NO linux implementation yet to create WMA audio. so if you can only use linux to create video files you WILL need to install TCPMP on your device to be able to play the files.

the command you should use (to start with:


ffmpeg -i input.avi output.avi -s 320x240 -b 200 -ar 64 -ac 1

settings explained:

-b bitrate in Kbps. the higher the bitrate the bigger the file, the better the quality.
-ar audio bitrate in Kbps
-ac audio channels, 1 for mono, 2 for stereo

200kbps on 320x240 is average quality. I usually use 300kbps for better results
64kbps mono sounds the same as 128kbps stereo. you will not have stereo effects such as a car moving from left to right, but it saves you quite a bit on filesize. 64kbps stereo is the same quality as 32kbps mono, which is average. If you want smaller you can use this.

Changing framerate or audio rate settings can (and usually will) result in audio synchronisation issues. this is when you watch the movie, and the lips do not move at the same time as when you hear the words.
Also, changing these do NOT reduce filesize. Reducing the framerate (-r 15 in yours) will double the quality basically.

300kbps / 30 frames per second is 10kb per frame
300kbps / 15 frames per second is 20kb per frame. quality is about double.


Edited by PocketDVD 2006-08-04 10:40 AM
 Top of the page
chazco
chazco Page Icon Posted 2006-08-04 11:18 AM
#
Status:
Thanks for the input everyone

Quote
your commandline : ffmpeg -i input.avi -s 320x240 -g 15 -r 15 -vcodec msmpeg4 -vtag div3 output.avi will work on TCPMP, but I wouldnt use this one. You are using the Microsoft AVI format, which isnt that good a quality. This results in files that play normally without any additional codecs on a desktops computer's Windows Media Player, but the Media Player on your device can ONLY play WMA, MP# audio files and WMV video files. It does not handle avi files.

FFMPEG can create video files that use the WMV format, but unfortunately there is NO linux implementation yet to create WMA audio. so if you can only use linux to create video files you WILL need to install TCPMP on your device to be able to play the files.

I'm already using TCPMP, i've used it before and its quite good (it plays all my files without converting, its just the larger ones i'm reducing). The playback quality is very good when using the graphics acceleration on my 3970, and the interface is quite friendly. And yes, i only have access to Linux for this.

C:Amie
You could <snip> surprisingly -acodec AAC or MPEG.

BrianD
If it is <snip> hear much difference on a PPC/HPC.

Quote
ffmpeg -i input.avi output.avi -s 320x240 -b 200 -ar 64 -ac 1

I've been trying to figure out how to set the audio rates and so on using ffmpeg, but couldnt get to the documentation (ISP problems and the man page isnt installed). I used to do this when i was on Windows with the media encoder. These will almost always be played using the built in speaker...

I'll try your command later (when the computer is free), thanks. So, hopefully, that should give a resonable quality fullscreen video for TCPMP at a resonable size?

Quote
unsurprisingly -acodec AAC or MPEG.

Should i set one of these as well?

Edited by chazco 2006-08-04 11:21 AM
 Top of the page
chazco
chazco Page Icon Posted 2006-08-04 11:47 AM
#
Status:
Ok... I re-organised your command since ffmpeg didnt like it, but have got an error:

Quote
chazco@chazco:ffmpeg -i "input.avi" -s 320x240 -b 200 -ar 64 -ac 1 output.avi
ffmpeg version CVS, build 3276800, Copyright (c) 2000-2004 Fabrice Bellard
configuration: --extra-cflags=-fomit-frame-pointer -DRUNTIME_CPUDETECT --build i486-linux-gnu --enable-gpl --enable-pp --enable-zlib --enable-vorbis --enable-libogg --enable-theora --enable-a52 --enable-dts --enable-dc1394 --enable-libgsm --disable-debug --prefix=/usr
built on Nov 24 2005 10:19:02, gcc: 4.0.3 20051121 (prerelease) (Ubuntu 4.0.2-4ubuntu3)
Input #0, avi, from 'input.avi':
Duration: 00:21:41.0, start: 0.000000, bitrate: 1132 kb/s
Stream #0.0: Video: mpeg4, yuv420p, 640x480, 25.00 fps
Stream #0.1: Audio: ac3, 48000 Hz, stereo, 192 kb/s
Output #0, avi, to 'output.avi':
Stream #0.0: Video: mpeg4, yuv420p, 320x240, 25.00 fps, q=2-31, 200 kb/s
Stream #0.1: Audio: mp2, 64 Hz, mono, 64 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
[mp2 @ 0x8336308]Sampling rate 64 is not allowed in mp2
Error while opening codec for output stream #0.1 - maybe incorrect parameters such as bit_rate, rate, width or height


Any ideas?

Edited by chazco 2006-08-04 11:49 AM
 Top of the page
PocketDVD Page Icon Posted 2006-08-04 1:15 PM
#
Avatar image of PocketDVD
H/PC Philosopher

Posts:
363
Location:
Canada
Status:
try -acodec mp3

forgot that ffmpeg defaults to mp2 audio in every case

might want to add -vcodec mpeg4 as well

I prefer to use mencoder/mplayer for ppc conversion on linux


Edited by PocketDVD 2006-08-04 1:16 PM
 Top of the page
chazco
chazco Page Icon Posted 2006-08-04 1:35 PM
#
Status:
When i use mp3 it gives me:
Quote
Unsupported codec for output stream #0.1


Something tells me it's not going to work
 Top of the page
C:Amie Page Icon Posted 2006-08-04 3:09 PM
#
Avatar image of C:Amie
Administrator
H/PC Oracle

Posts:
18,002
Location:
United Kingdom
Status:
You could always download DVD Catalyst and get it to do the video conversion for you

-b 200 is default so it will not change anything

The error message you are getting is because you cannot have 64k bps on the audio feed, try 32 or 128k. Or try the AAC codec.
 Top of the page
PocketDVD Page Icon Posted 2006-08-04 4:13 PM
#
Avatar image of PocketDVD
H/PC Philosopher

Posts:
363
Location:
Canada
Status:
Quote
chazco - 2006-08-04 12:35 PM

When i use mp3 it gives me:
Quote
Unsupported codec for output stream #0.1


Something tells me it's not going to work


then your compile of ffmpeg does not seem to have mp3 support compiled in.

As you know, Linux has sources for all programs for it available, and as of such, you can create customized versions of the programs with additional codecs, less codecs etc.

you can try and do a "ffmpeg -formats" to see what codecs are supported.

you can google around for the man page to actually be able to see it.
you can also type in something like "man ffmpeg" to bring it up.

On a side note, I would recommend looking around on some linux forums, where this question has been answered numerous times. I'm not running linux, and in addition, there are about 300 different distributions available.
Look for the proper website for your distribution.

the commands and information I gave you should work in most cases, but this is as far as I can go. I'm not going to explain how to compile a custom ffmpeg, or on how to add additional codecs to ffmpeg or anything among those lines. that information is availiable by using google, as well as by looking around on the website of your linux distribution.

The linux distribution I learned the most from is gentoo. (www.gentoo.org) it teaches you all these things. do a search on forums.gentoo.org for "pocketpc video" and you will see what I mean.
 Top of the page
chazco
chazco Page Icon Posted 2006-08-04 4:19 PM
#
Status:
I'll keep working on it, thanks for the help

Quote
You could always download DVD Catalyst and get it to do the video conversion for you

Thought about it, no linux version...
 Top of the page
C:Amie Page Icon Posted 2006-08-04 4:48 PM
#
Avatar image of C:Amie
Administrator
H/PC Oracle

Posts:
18,002
Location:
United Kingdom
Status:
Time to install BOCHS on your linux box
 Top of the page
chazco
chazco Page Icon Posted 2006-08-04 4:57 PM
#
Status:
Right, for ffmpeg to understand MP3 for encoding you need to install Lame. Done that. Now i need to tell ffmpeg that its there. It seems the command i need is "./configure --enable-mp3lame". However, this sounds like something i'd do when compiling it...

I'll keep working on it...
 Top of the page
CE Geek Page Icon Posted 2006-08-04 5:47 PM
#
Avatar image of CE Geek
Global Moderator
H/PC Oracle

Posts:
12,671
Location:
Southern California
Status:
Quote
chazco - 2006-08-04 1:57 PM

Right, for ffmpeg to understand MP3 for encoding you need to install Lame.


Lame? Is that really what it's called?
 Top of the page
PocketDVD Page Icon Posted 2006-08-04 6:11 PM
#
Avatar image of PocketDVD
H/PC Philosopher

Posts:
363
Location:
Canada
Status:
I think I found the source of your issue.

http://po-ru.com/diary/fixing-ffmpeg-on-ubuntu/

the ffmpeg in UBUNTU linux is crippled for licensing issues.
the link explains how and what you can do.

(guess I will stick to Gentoo Linux, and skip Ubuntu if they do these kinds of things)
 Top of the page
1 2
Jump to forum:
Seconds to generate: 0.203 - Cached queries : 66 - Executed queries : 8