LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How to encode MP4 videos for SE k800i? (https://www.linuxquestions.org/questions/linux-software-2/how-to-encode-mp4-videos-for-se-k800i-610592/)

ivanatora 01-02-2008 09:27 AM

How to encode MP4 videos for SE k800i?
 
Hello,
I have Sony Ericsson k800i and I want to encode some videos to watch on it. Here are its supported codecs:
Code:

# MP3, WMA, RealAudio 8 and AAC/AAC+/eAAC+ audio
# MP4, 3GP and RealVideo 8 video

I want to use mencoder.
Here I have a video 253can-low.avi which is 320x240, so I won't had to care of resizing for now.
I tried following:
Code:

/usr/local/bin/mencoder 253can-low.avi -o out.mp4 -ovc x264 -oac mp3lame
(I have another mplayer and mencoder installed in /usr/bin, but they are compiled at time I did not had x264 installed)
And I get the following:
Code:

MEncoder 1.0rc2-3.4.6 (C) 2000-2007 MPlayer Team
CPU: Intel(R) Pentium(R) 4 CPU 3.00GHz (Family: 15, Model: 4, Stepping: 1)
CPUflags: Type: 15 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled for x86 CPU with extensions: MMX MMX2 SSE SSE2


WARNING: OUTPUT FILE FORMAT IS _AVI_. See -of help.
success: format: 0  data: 0x0 - 0x20cb000
AVI file format detected.
[aviheader] Video stream found, -vid 0
[aviheader] Audio stream found, -aid 1
VIDEO:  [DX50]  320x240  24bpp  29.970 fps  299.9 kbps (36.6 kbyte/s)
[V] filefmt:3  fourcc:0x30355844  size:320x240  fps:29.97  ftime:=0.0334
==========================================================================
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
AUDIO: 12000 Hz, 2 ch, s16le, 16.0 kbit/4.17% (ratio: 2000->48000)
Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3)
==========================================================================
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffodivx] vfm: ffmpeg (FFmpeg MPEG-4)
==========================================================================
MP3 audio selected.
VDec: vo config request - 320 x 240 (preferred colorspace: Planar YV12)
VDec: using Planar I420 as output csp (no 1)
Movie-Aspect is 1.33:1 - prescaling to correct movie aspect.
x264 [error]: no ratecontrol method specified
x264_encoder_open failed.
FATAL: Cannot initialize video driver.

Exiting...

I'm not sure if there must be added additional options for x264? Or I'm completely wrong about x264 and I don't need it?
What is the simpliest way to encode video for that phone?

Update: I tried using lavc:
Code:

mencoder 253can-low.avi -o out.mp4 -ovc lavc -lavcopts vcodec=mpeg4 -oac mp3lame
But the output file size is way too big: input file of 33MB became output file 85MB. I don't think this is correct, becouse it pushes the bitrate from
Code:

VIDEO:  [DX50]  320x240  24bpp  29.970 fps  299.9 kbps (36.6 kbyte/s)
To:
Code:

VIDEO:  [FMP4]  320x240  24bpp  29.970 fps  812.7 kbps (99.2 kbyte/s)
Update2: I managed to limit the bitrate at 384Kbps as suggested and the filesize was 35MB, but once I upload that clip to the phone it won't play it. It doesn't have 'view' option nor preview - I think something is wrong with the mencoder settings.

gacott 01-02-2008 03:46 PM

MediaCoder
 
I don't know, but the older I get the less I want to mess with a number of things . . . Video encoding is one of them. I run MediaCoder http://mediacoder.sourceforge.net/ under wine and it does the job just great for me. It is open source and they are working on a native Linux version also . . . but it really does run just fine in wine.

xs_gandalf 09-09-2009 12:31 AM

Solution
 
If You have avidemux (or ubuntu), follow the screenshots here:

(url banned, just google for "k800i mencoder")

(all GUI, maybe except "sudo apt-get install ...", which can be done with a GUI too).

For mencoder, which You seem to prefer, there is a solution in the comments below that post:

mencoder -ofps 24 -of lavf -lavfopts format=mp4 -af lavcresample=48000:channels=1 -vf-add harddup -vf-add scale=320:-2 -oac lavc -ovc lavc -lavcopts aglobal=1:vglobal=1:acodec=libfaac:abitrate=128:vcodec=mpeg4:vbitrate=384:keyint=25 -subfont-text-scale 4 -subcp cp1250 -sws 9 input_file.avi -sub subtitle_file.txt -o output.mp4

If You don't need subtitles, this simplifies to:

mencoder -ofps 24 -of lavf -lavfopts format=mp4 -af lavcresample=48000:channels=1 -vf-add harddup -vf-add scale=320:-2 -oac lavc -ovc lavc -lavcopts aglobal=1:vglobal=1:acodec=libfaac:abitrate=128:vcodec=mpeg4:vbitrate=384:keyint=25 input_file.avi -o output.mp4

(I leave the scaling, because it doesn't hurt, I think).

I tried with -ofps ranging from 15 to 24 (with 23.9.. something), but I don't see any significant difference on the phone. It may have some internal framedrop...

eglisius.rezidokularakis 08-14-2012 12:52 PM

I tried xs_gandalf's mencoder method without subtitles under Ubuntu 12.04, and it worked fine--after having replaced "acodec=libfaac" by "acodec=aac". Thanks a lot!


All times are GMT -5. The time now is 12:53 AM.