LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-04-2010, 04:38 AM   #1
puneeth bhat
Member
 
Registered: Jan 2010
Posts: 30

Rep: Reputation: 15
Wink how to store h.264 file on avi container


i m trying to store h.264 in avi container using ffmpeg....is it possible using ffmpeg.i m using v4l to capture a image and compressed in to h.264,now please help me out how i can store it in avi container,any programming example,header format for avi container,and what other information required to store in a container.
 
Old 03-04-2010, 04:51 AM   #2
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
You convert it to theora and store it in an ogg container.

It is not a good idea to use encumbered formats unless you cannot avoid it.
It can be managed though:

http://ubuntuforums.org/showthread.php?t=643334
... takes an avi and turns it into mpeg4 using h264

http://www.mail-archive.com/linux-il.../msg51064.html
... turninf a vob into an avi.

You specify the video and audio codec on the commandline along with input and output filenames.
 
Old 03-04-2010, 05:59 AM   #3
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
How exactly are you obtaining and converting this video ? using what and how ?

Quote:
Originally Posted by Simon Bridge View Post
You convert it to theora and store it in an ogg container.

It is not a good idea to use encumbered formats unless you cannot avoid it.
You can always say that a format is for sure patent encumbered, but you can never say that a format is for sure not patent encumbered. The only time you will be able to tell is in court when some company calls you up and says you are breaking their patent.
 
Old 03-04-2010, 07:13 AM   #4
puneeth bhat
Member
 
Registered: Jan 2010
Posts: 30

Original Poster
Rep: Reputation: 15
Smile Avi

i m getting h.264 from renesas board i m able to display on sdl using ffmpeg converting it in to yuv format,i need to store it in a avi container,any websites or any sample code which can help me to store?
 
Old 03-04-2010, 11:56 PM   #5
puneeth bhat
Member
 
Registered: Jan 2010
Posts: 30

Original Poster
Rep: Reputation: 15
Thumbs up h.264 in avi container

can i encode h.264 in avi container,i didnt find ant id to convert,as i have seen some example outputexample.c in ffmpeg ther it guess the format,will this converted format be in avi or mpeg4 format..can any one help regarding this..tell me any links which would help regarding this.
 
Old 03-05-2010, 12:41 AM   #6
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
AIUI, there are some 3rd-party hacks out there that supposedly make it possible, but in general .avi is not a good match for mpeg4 AVC, mostly due to a lack of b-frame support. I don't know if any of the hacks are available in Linux.

In any case, it seems that some hacking of the .avi format is needed to crowbar in just about any of the modern codecs. It's much better to simply go with a newer container that has proper support. What's keeping you from simply using the .mp4 container that was specifically designed for mpeg4? Or matroska, which supports just about everything?

http://en.wikipedia.org/wiki/Compari...tainer_formats

Last edited by David the H.; 03-05-2010 at 12:43 AM.
 
Old 03-05-2010, 02:25 AM   #7
primerib
Member
 
Registered: Mar 2010
Posts: 48

Rep: Reputation: 20
Technically yes you can do it but why would you want to hassle with it at all? Using the matroska (.mkv) container is a far better option and anything that can play h264 in an avi should also support mkv.
 
Old 04-08-2010, 08:37 AM   #8
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Duplicate threads merged
 
Old 04-08-2010, 08:42 AM   #9
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Quote:
Originally Posted by primerib View Post
Technically yes you can do it but why would you want to hassle with it at all? Using the matroska (.mkv) container is a far better option and anything that can play h264 in an avi should also support mkv.
I agree, mkv is the way to go unless you need to use avi so it plays on Divx compatible players, in which case you would use xvid/mpeg4 video instead.
 
Old 04-09-2010, 07:08 PM   #10
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
Quote:
Originally Posted by H_TeXMeX_H View Post
You can always say that a format is for sure patent encumbered, but you can never say that a format is for sure not patent encumbered. The only time you will be able to tell is in court when some company calls you up and says you are breaking their patent.
Which is why I suggested theora.

Theora is for sure a patent-bearing format, however it is available royalty-free under public domain. Thus, it is not "encumbered" by the patent.

http://www.theora.org/

Patents and software or data-formats are troublesome for exactly the reason you describe - there is no telling if some troll has a patent which could arguably cover the stuff we have been using and who can afford to defend?

It is thus generally and always good advise to avoid known encumbered formats in favour of those which have been around long enough to attract an infringement notice and/or court action but which have failed to do so.

Fully published and open formats with a legally binding royalty waiver are good for this. It kinda gives patent trolls notice to act quickly or forever hold their peace. Favouring this sort of approach even for our personal stuff, discourages this patent silliness in the long run.

As good community members, we should act with knowledge of how our actions affect things outside our immediate wants.
 
Old 04-09-2010, 07:26 PM   #11
tuxdev
Senior Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 2,012

Rep: Reputation: 115Reputation: 115
Free is nice and all, but the quality out of Theora is terrible. The format fundamentally can't support some of the more recent advances in encoders.
 
Old 04-10-2010, 03:29 AM   #12
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Quote:
Originally Posted by Simon Bridge View Post
Which is why I suggested theora.

Theora is for sure a patent-bearing format, however it is available royalty-free under public domain. Thus, it is not "encumbered" by the patent.

http://www.theora.org/
I would like to take your advice, and have tried to, but as tuxdev says, it just doesn't cut it for good quality. And, sometimes I have to use a specific format, because it's the only thing the player will play (like Divx/Xvid).

I've also tried dirac, and it really sucks.

I'll be using the good quality patent-encumbered codecs (in US only) until they are taken down, then I'll be forced to use something else, and by that time, maybe one of there projects will have produced something good.
 
Old 04-10-2010, 03:30 AM   #13
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
Quote:
Originally Posted by tuxdev View Post
Free is nice and all, but the quality out of Theora is terrible. The format fundamentally can't support some of the more recent advances in encoders.
Please support those assertions: which research are you using? What do you mean by "fundamentally"? Which "recent advances"?

Bear in mind that Theora is targeted at competing with MPEG-4 (e.g., XviD and DivX), RealVideo, Windows Media Video, and similar lower-bitrate video compression schemes. Thus it will suffer in comparison with recent high-bitrate schemes. OP wanted H.264 (which is a specification, not a codec) in an avi container...

You realise that MPEG-LA have extended H.264 specification royalties (for internet streaming) only until 2016? After that you have to pay.
http://arstechnica.com/media/news/20...64-license.ars
... if you are going to use an h264 implementation, you are best advised to make sure you understand the license terms.

The royalties were supposed to come in this year - most likely the open competition with a free format in html5 has prompted them to hold off. They may be convinced to hold off some more, if they decide that they can use ubiquitous h264 streaming to leverage royalties for encoders. In that case, it may become the new gif.

http://www.osnews.com/story/19019/Theora-vs.-h.264
... theora used to lag H264 compression, but the inclusion as an internet streaming standard in html5 as well as head-to-head comparisons like this one have focussed development considerably:
http://news.slashdot.org/article.pl?.../05/07/2352203
... development is ongoing - if you want a feature, first check that it is what theora is supposed to do, then request it. The more people join in, the faster this will go.

http://en.wikipedia.org/wiki/Comparison_of_video_codecs
... we just don't know much that is objective about non-free codecs.

http://www.100fps.com/codec_quality_comparison.htm
... before you compare video or image quality, check out these examples.

I will not advise someone to sacrifice their freedom, or that of others, in return for a prettier picture.

At the moment, theora is the only viable fee codec for internet streaming. Contenders are Dirac/Schodinger and VP8 - we've got 6 years to sort it out: fingers crossed.
 
Old 04-10-2010, 04:55 AM   #14
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
Quote:
Originally Posted by H_TeXMeX_H View Post
I would like to take your advice, and have tried to, but as tuxdev says, it just doesn't cut it for good quality. And, sometimes I have to use a specific format, because it's the only thing the player will play (like Divx/Xvid).
Yeah, some of us are stuck with vendor lock-in. You don't have to - firefox is a theora player for example, so is VLC: both cross-platform.

Sometimes it happens to be what the encoder (eg. in a video camera) uses - transcoding can do funny things to the bitrate and resolution. Unlike vorbis, we don't seem to be seeing native theora support in HW encoders ... yet.

You have not said what it is that "just doesn't cut it for good quality" - have you tried a recent encoder? How are you measuring quality?

Whatever - I understood that you may have a particular reason you weren't telling us for choosing the container+specification you did rather than just assuming that "video = avi+mpeg4" like so many people assume "music=mp3". That is why I also pointed you to methods of getting what you specified.

Not everyone asking for that combination needs it.

Quote:
I've also tried dirac, and it really sucks.
Nobody claims otherwise - the practical implementation is called "schrodinger". But the only reason to try it is if you want to stream High Definition and you are a developer. It is still very experimental - but note: it is usually the encoder or the player which messes up, not intrinsic to the codec itself.

If your aim is to encode high definition video for personal storage, then theora will certainly not work well - it's not intended for that. You can get HD resolutions, but at the expense of the bitrate.

Quote:
I'll be using the good quality patent-encumbered codecs (in US only) until they are taken down, then I'll be forced to use something else, and by that time, maybe one of there projects will have produced something good.
You have until 2016 - after which, internet streaming could face similar royalty schemes to TV broadcast (erk!)

There is some speculation that the extension on the royalty deadline is a bait and switch tactic.

But look what you are saying: you'd rather be chained to a comfy chair than stand or sit on an uncomfortable one.

I know everyone is supposed to have a price these days, I just hoped it would be a bit higher than that.

We are in a transition period - if we want comfy chairs to come without annoying inquisitors, we have to start using the less comfy ones for preference. But hey - no worries right? Enjoy.
 
Old 04-10-2010, 05:28 AM   #15
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
I've done my own comparisons, and I've seen many internet comparisons, and I'm sorry but, at the moment theora is the lowest quality of the major codecs, at the same file size or almost. I think if h264 will be taken down because of patents, development of theora will increase greatly, because people will realize that this is the way to go, and then maybe the quality will increase a lot.

I guess there's no chance of repealing software patents, cuz that would be nice, easy solution.
 
  


Reply

Tags
avi, container



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
Converting h.264 avi video to mpg btbx Linux - Software 1 06-12-2008 07:48 PM
how can I play file avi file with DivX6.40 1280x720 24fps nos1833 Debian 2 12-27-2007 11:45 PM
Container/Dir/File encryption ofr chroot jail The_JinJ Linux - Security 4 12-17-2005 11:40 AM
AVI H.264 Urgent Help cppkid Programming 0 09-27-2005 01:43 AM
Is there a possible way to play H.264 encoded file(s) in linux? hkl8324 Linux - Software 0 07-29-2005 03:43 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:41 AM.

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