Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Converting h264 to xvid [SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
memborg
Tux's lil' helper
Tux's lil' helper


Joined: 16 Jun 2003
Posts: 121
Location: Aalborg, Denmark

PostPosted: Wed Dec 14, 2005 9:26 am    Post subject: Converting h264 to xvid [SOLVED] Reply with quote

Hi there

I want to convert my h.264 movie with aac audio to xvid with mp3 audio. Hwo do I do that?
The reason for this conversion is that I cannot get mplayer to playback the video, so then I wanted to convert it.

Best Regards
Memborg
_________________
The Penguin Credo: Never Swim Alone


Last edited by memborg on Mon Jan 02, 2006 3:16 pm; edited 1 time in total
Back to top
View user's profile Send private message
Shadow Skill
Veteran
Veteran


Joined: 04 Dec 2004
Posts: 1023

PostPosted: Wed Dec 14, 2005 9:56 am    Post subject: Reply with quote

First you need to demux the video from whatever file format it is contained in then you need to do the same for the audio and reencode them to your desired format. Try avidemux that might be what you are looking for.

May I ask what version of mplayer are you using, and what architecture are you running, and what use flags did you set for mplayer?

mine are
Code:
These are the packages that I would merge, in order:

Calculating dependencies ...done!
[ebuild   R   ] media-video/mplayer-1.0_pre7-r1  (-3dfx) (-3dnow) (-3dnowext) +X +aac -aalib +alsa (-altivec) -arts -bidi -bindist -bl -cdparanoia -cpudetection -custom-cflags -debug -dga -directfb -doc +dts -dv -dvb +dvd +dvdread -edl +encode +esd -fbcon* -ggi +gif +gtk -i8x0 +ipv6 -jack -joystick +jpeg -libcaca -lirc -live -livecd -lzo +mad +matroska -matrox (-mmx) (-mmxext) -mythtv -nas +nls -nvidia +opengl -oss +png -real -rtc -samba +sdl (-sse) (-sse2) (-svga) -tga +theora +truetype -v4l -v4l2 +vorbis (-win32codecs) -xanim -xinerama -xmms +xv +xvid -xvmc 0 kB

Total size of downloads: 0 kB
H264 works for me I'm running amd64 though.
_________________
Ware wa mutekinari.
Wa ga kage waza ni kanau mono nashi.
Wa ga ichigeki wa mutekinari.

"First there was nothing, so the lord gave us light. There was still nothing, but at least you could see it."
Back to top
View user's profile Send private message
memborg
Tux's lil' helper
Tux's lil' helper


Joined: 16 Jun 2003
Posts: 121
Location: Aalborg, Denmark

PostPosted: Wed Dec 14, 2005 10:15 am    Post subject: Reply with quote

Sure, I am running x86
Code:

media-video/mplayer-1.0_pre7-r1  -3dfx -3dnow -3dnowext +X +aac +aalib +alsa (-altivec) -arts -bidi -bindist -bl -cdparanoia -cpudetection -custom-cflags -debug -dga +directfb -doc +dts +dv -dvb +dvd +dvdread -edl +encode -esd +fbcon -ggi +gif -gtk -i8x0 -ipv6 -jack +joystick +jpeg -libcaca -lirc -live -livecd +lzo +mad -matroska -matrox +mmx -mmxext +mythtv -nas +nls -nvidia +opengl -oss +png -real -rtc +samba +sdl +sse +sse2 -svga -tga +theora +truetype -v4l -v4l2 +vorbis +win32codecs -xanim -xinerama -xmms +xv +xvid -xvmc


mencoder fail with this message: mencoder: h264.c:2306: mc_dir_part: Assertion `pic->data[0]' failed.
I am using these commands:
Code:

mencoder video.mp4 -nosound -o pass1.avi -sws 2 -ovc xvid -xvidencopts pass=1:chroma_me:max_bframes=2:bvhq=1:vhq=1:trellis

_________________
The Penguin Credo: Never Swim Alone
Back to top
View user's profile Send private message
memborg
Tux's lil' helper
Tux's lil' helper


Joined: 16 Jun 2003
Posts: 121
Location: Aalborg, Denmark

PostPosted: Wed Dec 14, 2005 11:14 am    Post subject: Reply with quote

Well I found how to do it with ffmpeg instead. Only problem is the sound conversion. The aac audio is to slow when it gets converted to mp3 :|
_________________
The Penguin Credo: Never Swim Alone
Back to top
View user's profile Send private message
Shadow Skill
Veteran
Veteran


Joined: 04 Dec 2004
Posts: 1023

PostPosted: Wed Dec 14, 2005 11:07 pm    Post subject: Reply with quote

hmm I dont have any experience with transcoding in Linux so I can't really help you. I am curious though what error did you get when trying to play the H264 file with mplayer and what are your ffmpeg use flags?
_________________
Ware wa mutekinari.
Wa ga kage waza ni kanau mono nashi.
Wa ga ichigeki wa mutekinari.

"First there was nothing, so the lord gave us light. There was still nothing, but at least you could see it."
Back to top
View user's profile Send private message
memborg
Tux's lil' helper
Tux's lil' helper


Joined: 16 Jun 2003
Posts: 121
Location: Aalborg, Denmark

PostPosted: Thu Dec 15, 2005 7:39 am    Post subject: Reply with quote

Shadow Skill wrote:
hmm I dont have any experience with transcoding in Linux so I can't really help you. I am curious though what error did you get when trying to play the H264 file with mplayer and what are your ffmpeg use flags?


Well... The error I get is:
Code:

mplayer: h264.c:2306: mc_dir_part: Assertion `pic->data[0]' failed.

It is the same error mencoder gives me.

And the useflags for ffmpeg:
Code:

media-video/ffmpeg-0.4.9_p20051120  +a52 +aac (-altivec) -debug -doc +dts +encode -ieee1394 -imlib +mmx +network +ogg -oss +sdl -test +theora       +threads +truetype -v4l +vorbis +xvid +zlib

_________________
The Penguin Credo: Never Swim Alone
Back to top
View user's profile Send private message
ukl
Apprentice
Apprentice


Joined: 05 Mar 2005
Posts: 228
Location: /dev/null

PostPosted: Sat Dec 31, 2005 8:18 am    Post subject: Reply with quote

That`s my problem too. Same error.
_________________
Pozdrawiam
Paweł
Back to top
View user's profile Send private message
mr_maniac_2k6
n00b
n00b


Joined: 01 Jan 2006
Posts: 1

PostPosted: Sun Jan 01, 2006 3:09 pm    Post subject: Reply with quote

... so, this i my first post on the gentoo forums. I found most of the answers to my gentoo problems on this forum so i think it's time to give something back.

Yesterday i had exactly the same problem of converting a h264 file to xvid. First, using ffmpeg alone resulted in a xvid file with the audio beeing to slow. This is how i solved it:

1. Extract audio from h264 file using MP4Box (part of media-video/gpac)

Code:
MP4Box -raw 2 video.h264


This extracts the 2nd track in raw format (in my case aac). First track is the video track of course.

2. Convert aac to wav using media-libs/faad2

Code:
faad extracted_audio.aac


This results in a wav file used in step 4.

3. Convert h264 video only to xvid using media-video/ffmpeg

Code:
ffmpeg -i video.h264 -vcodec mpeg4 -vtag xvid -b BITRATE -an video_noaudio.xvid


The -an tag omitts the audio to be converted. Replace BITRATE with your desired encoding bitrate.

4. Copy the video track and encode the audio track into mp3 using media-video/ffmpeg

Code:
ffmpeg -i video_noaudio.xvid -vcodec copy -vtag xvid -i audio.wav video_ready.xvid


Additional options for the audio track like bitrate and so on can be used, see the ffmpeg documentation.

For me this solution worked, i hope it works for you too.
Back to top
View user's profile Send private message
mean
Guru
Guru


Joined: 25 Sep 2002
Posts: 313

PostPosted: Sun Jan 01, 2006 4:58 pm    Post subject: Reply with quote

avidemux 2.1.0 should be able to read such files and convert them to xvid/lame or whatever
Back to top
View user's profile Send private message
memborg
Tux's lil' helper
Tux's lil' helper


Joined: 16 Jun 2003
Posts: 121
Location: Aalborg, Denmark

PostPosted: Mon Jan 02, 2006 3:15 pm    Post subject: Reply with quote

Happy new year!!

Thanx for the replies. I like the step-by-step guide.

I will mark this one solved!

Cheers!
_________________
The Penguin Credo: Never Swim Alone
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum