View Full Version : How to convert .mpg (MPEG-2) to H.264 easily?
LonelyPixel
2nd December 2008, 22:24
Hi,
attention, this is a totally beginner's question (from a not-so-beginner).
While I do have some experience with video formats, codecs and player software, I'm entirely lost on this one. I usually converted TV recordings from .mpg (MPEG-2 PS) to .avi with DivX using DVDx. It supports 2-pass encoding and lets me handle files and configure encoding parameters (not that I would need that much of choice, but the video bandwidth would be nice to set) so I could understand what's going on.
Now I was trying on x264. ffdshow has a VfW interface and supports H.264 encoding - in theory. DVDx actually crashes when I try. x264 doesn't have a VfW interface, at least I wasn't able to find a download that doesn't have a "warning/unmaintained/otherwise broken" label on it. DVDx only supports VfW, no DirectShow.
MeGUI+AviSynth was my next try, but the mass of options just blew me away. No chance I could use that.
x264.exe, supposedly the raw CLI encoder, cannot read MPEG-2 files, only .avi or AviSynth which looks a bit too complicated for my very simple need.
So what's left? Commercial solutions? 2 months of studying manpages? I'm not averse to a CLI solution, although a simple GUI with a progress bar would be better IMO. I'd like to convert from MPEG-2 PS (and nothing else - single video and audio stream, no extras, no DVD menus or such) to H.264 in .avi or .mkv format (not sure if one has features that just need to be used for some reason, probably .avi is easier). Audio could be MP3 or HE-AAC (AAC+ v2), the latter would be more efficient. I want efficient A/V compression usable on any client. Without the need to study the codec developers' work - which surely is ingenious but the end user really should not be burdened with.
Is there any healing for me?
LoRd_MuldeR
2nd December 2008, 22:28
Option 1:
Use x264 CLI encoder with Avisynth input. To access MPEG-2 from Avisynth use DGIndex (http://neuron2.net/dgmpgdec/dgmpgdec.html) and MEPG2Source(). Also you may want to use a decent GUI like MeGUI (http://neuron2.net/dgmpgdec/dgmpgdec.html) instead of running x264 from the console.
Option 2:
Use Avidemux (http://forum.doom9.org/showthread.php?t=126164). It's a self-contained video editor with a VirtualDub-like GUI. It supports MPEG-2 inpute natively and the x264 encoder is already built-in. 2-Pass is automated and a job queue is supported.
Option 3:
Go over to the dark side and use x264 VfW (http://sourceforge.net/project/showfiles.php?group_id=213809&package_id=257567) in VirtualDub. Not really recommended, should be the last option to consider...
nm
2nd December 2008, 23:29
In addition to Avidemux and MeGUI there are lots of nice encoding GUIs around. There's even an entire subforum devoted to them: http://forum.doom9.org/forumdisplay.php?f=78
Considering your needs, I would recommend HandBrake.
LoRd_MuldeR
2nd December 2008, 23:50
In addition to Avidemux and MeGUI there are lots of nice encoding GUIs around. There's even an entire subforum devoted to them: http://forum.doom9.org/forumdisplay.php?f=78
Only that Avidemux isn't yet another GUI to the x264 CLI encoder (or MEncoder/FFmpeg), but a fully-fledged standalone application ;)
infoeater
3rd December 2008, 00:58
Option 3:
Go over to the dark side and use x264 VfW (http://sourceforge.net/project/showfiles.php?group_id=213809&package_id=257567) in VirtualDub. Not really recommended, should be the last option to consider...
Why it's not recommend?
LoRd_MuldeR
3rd December 2008, 01:16
Why it's not recommend?
1. The x264 developers don't care about VfW. Consequently the VfW part was dropped from x264 officially long ago. It's now maintained by third parties.
2. VfW is an ancient technology that dates back to Windows 3.1 and has some harsh limitations that make it unsuitable for H.264. Hacks have been invented to circumvent these limits, but it's ugly!
3. Most people that use x264 VfW use it in VirtualDub. Unfortunately VirtualDub is limited to the AVI container, but H.264 definitely doesn't belong to AVI.
(Please everybody, don't take this post as a reason to continue the "x264 VfW" or "H.264 in AVI" flamewar. No need to discuss that again, really)
weaker
3rd December 2008, 01:16
Short answer: AVI is a very old container format that does not support everything x264 has to offer. At least not without hacking. Just let AVI die ;-)
Longer answer: Search the Doom9-forum for lots of information and emotions about that topic. "I wouldn't touch it with a ten foot pole" (if you know South Park).
Dark Shikari
3rd December 2008, 02:02
MeGUI? AutoMKV? Staxrip? Ripbot264? Avidemux? Handbrake? Mediacoder?
There are so many free GUIs for x264 that it's ridiculous, with complexity ranging from "one-click encode" to "all the bells and whistles you could possibly want."
And don't get it into your mind that Avisynth is "hard"; it's literally 30 seconds of effort.
LoRd_MuldeR
3rd December 2008, 02:14
And don't get it into your mind that Avisynth is "hard"; it's literally 30 seconds of effort.
Maybe for you :D
But for a newbie that is new to video encoding and never has written one single line of code?
Avisynth is very powerful indeed and it's worth learning, but its script based nature is not exactly the thing a newbie should start with ;)
However a decent GUI should prevent a user from getting in touch with Avisyth directly, unless explicitly wanted.
Dark Shikari
3rd December 2008, 03:03
Maybe for you :D
But for a newbie that is new to video encoding and never has written one single line of code?
Avisynth is very powerful indeed and it's worth learning, but its script based nature is not exactly the thing a newbie should start with ;)Since when you do have to write code to use Avisynth?
"Using Avisynth" is not in fact synonymous with "writing gigantic complicated denoising scripts."
I have yet to encounter anyone who was wise enough in the ways of video encoding to know what "Video for Windows" was but was incapable of writing "DirectShowSource("input.avi")".
Sagekilla
3rd December 2008, 03:10
Indeed avisynth is fairly straight forward.
Except for cropping and resizing (which are two beasts of their own kind, which can be troublesome whether you use avisynth directly or not) the only thing you really need is the source filter. For him, all that is just: MPEG2Source("source.d2v")
Easy. You can even reuse the same avisynth script + x264 encoding batch file. Just delete your old source.d2v file and index a new stream.
LoRd_MuldeR
3rd December 2008, 03:37
I have yet to encounter anyone who was wise enough in the ways of video encoding to know what "Video for Windows" was but was incapable of writing "DirectShowSource("input.avi")".
The task of writing isn't the problem. The "hard" part is to know that you have to do that and why it is helpful ;)
Before you can do that, you must understand that...
* Avisynth is a script based frameserver
* One can crate a script using Notepad (or another text/code editor) and save it as .avs file
* The syntax for instructions is "function(param_1=value_1, param_2=value_2, ... , param_n=value_n)"
* A script starts with a source filter
* There is a function called "DirectShowSource()" which opens almost any media (if required DShow filters are installed)
* Different colorspaces exist and it may be necessary to append "ConvertToYV12()" to script
* For MPEG-2 and AVC there are special Plugins available that should be preferred over DirectShowSource()
This all might be very obvious for you and most people hanging around here. But imagine you are a newbie that even doesn't know what a "script" is :scared:
Dark Shikari
3rd December 2008, 03:39
This all might be very obvious for you and most people hanging around here. But imagine you are a newbie that even doesn't know what a "script" is :scared:Then you don't try to understand things, you blindly follow the instructions, like everyone else ;)
nm
3rd December 2008, 09:41
Only that Avidemux isn't yet another GUI to the x264 CLI encoder (or MEncoder/FFmpeg), but a fully-fledged standalone application ;)
So is Handbrake. But I don't see any reason to avoid GUIs built on top of command-line tools as long as they do what they are supposed to.
roozhou
3rd December 2008, 11:59
Avisynth can never be an EASY way. Try my dshow x264 here.
http://forum.doom9.org/showthread.php?t=141441
It's as easy as watching the video.
Demuxing by DGIndex + write MPEG2Source in .avs seems an obsolete and stupid way. It neither saves time nor gives better quality. I don't think there exists any people watching DVD in this way. And encoding should go in the same way as people watch it.
Guest
3rd December 2008, 14:41
Demuxing by DGIndex + write MPEG2Source in .avs seems an obsolete and stupid way. It's not stupid if you need frame accurate processing and your DirectShow filter doesn't support it, as many don't. In your cited thread you talk about this and consider adding support for that to your tool. It's also not stupid if you need Avisynth scripting for your processing. Avisynth frame caching is also very useful. And calling other people and their tools stupid could get you a rule 4 strike.
Why do you think so many people use it and why several important third party apps use it? Because everybody is stupid?
I don't think there exists any people watching DVD in this way. And encoding should go in the same way as people watch it. That's completely illogical.
laserfan
3rd December 2008, 15:00
Avisynth can never be an EASY way. Try my dshow x264 here.Ha, ha!!! I looked at the first post in that thread: you're kidding, right??? :p
To make a d2v w/DGMPGDec package and Avisynth-it to x264 CLI could hardly be easier (even only 3 softwares to be installed on your computer). I don't understand why a "smart guy" like you would have to disparage it... :devil:
Guest
3rd December 2008, 15:13
Then you don't try to understand things, you blindly follow the instructions, like everyone else ;) This says it all for me. If someone cannot follow the Quick Start guide that comes with DGMPGDec, then they shouldn't be doing video work at all.
http://neuron2.net/dgmpgdec/QuickStart.html
survivant001
3rd December 2008, 15:30
it's funny to read the thread, because I was trying to do that this week :) I have mpeg that were recorded by my receiver and I wanted to convert them in mp4 for my PS3. I try ripbot and automkv, but automkv failed to read the clip and ripbot works well when the movie doesn't contains errors in the stream. (ok, it's not normal to have bad stream).
but I'm still block when the audio (mp2) contains errors.. I didn't find a way to convert it. I try with eac2to but it failed. few mpegs converter, the failed because the stream is not readable..
LoRd_MuldeR
3rd December 2008, 15:51
This says it all for me. If someone cannot follow the Quick Start guide that comes with DGMPGDec, then they shouldn't be doing video work at all.
http://neuron2.net/dgmpgdec/QuickStart.html
Well, not everybody is willing to read a guide first, just to convert a few videos. Also I'm pretty sure that many people who are not used to these kind of tasks won't be able to understand the guide easily. It may be easy to understand for people that work with the PC every day, but didn't use Avisynth before. But if you neither used Avisynth before nor are very experienced with the PC, it will be hard to follow. I'm pretty sure my dad wouldn't be able to follow. But do you want to exclude these people from converting their videos? I don't think so. And there are many "One Click" GUIs that are pretty self-explaining and don't need any precognition. So my point stands: While Avisynth is a powerful software that servers well for many people (and isn't that hard to learn for most people), still it's not the most convenient solution for everybody's needs...
But I don't see any reason to avoid GUIs built on top of command-line tools as long as they do what they are supposed to.
I didn't say that a GUI on top of a CLI encoder is better or worse than a self-contained application.
LonelyPixel asked for a way to convert MPEG-2 to H.264 and I was trying to give a complete list of the different options available.
He then can decided what he likes best...
Guest
3rd December 2008, 16:11
Well, not everybody is willing to read a guide first, just to convert a few videos. Also I'm pretty sure that many people who are not used to these kind of tasks won't be able to understand the guide easily. It may be easy to understand for people that work with the PC every day, but didn't use Avisynth before. But if you neither used Avisynth before nor are very experienced with the PC, it will be hard to follow. I'm pretty sure my dad wouldn't be able to follow. But do you want to exclude these people from converting their videos? I don't think so. I don't care about anybody that won't read the instructions. And I don't care about people that want to dabble in a technical area without educating themselves first. It's not my mission in life to enable clueless Joe Six-Pack to copy his videos.
nm
3rd December 2008, 16:14
it's funny to read the thread, because I was trying to do that this week :) I have mpeg that were recorded by my receiver and I wanted to convert them in mp4 for my PS3. I try ripbot and automkv, but automkv failed to read the clip and ripbot works well when the movie doesn't contains errors in the stream. (ok, it's not normal to have bad stream).
but I'm still block when the audio (mp2) contains errors.. I didn't find a way to convert it. I try with eac2to but it failed. few mpegs converter, the failed because the stream is not readable..
If the video is standard definition MPEG-2, use Project X (http://project-x.sourceforge.net/) to fix the file before processing it further. Unfortunately most of the builds on the web are over two years old, so if you need latest features and fixes, you may need to build it from CVS yourself.
Further information and links to binaries (jars) are here: http://avidemux.org/admWiki/index.php?title=Project_X
roozhou
3rd December 2008, 16:53
It's not stupid if you need frame accurate processing and your DirectShow filter doesn't support it, as many don't. In your cited thread you talk about this and consider adding support for that to your tool. It's also not stupid if you need Avisynth scripting for your processing. Avisynth frame caching is also very useful. And calling other people and their tools stupid could get you a rule 4 strike.
Why do you think so many people use it and why several important third party apps use it? Because everybody is stupid?
Actually only a small portion of people use avisynth. Avisynth is useless for 99% of PC users. And 90% of encoding does not need frame accurate processing or non-linear editing. Avisynth itsself uses outdated VFW interface and lacks lots of useful features. It does not support vfr, streaming(require fixed frame numbers), aspect ratio. You cannot apply changes immediately, making tuning quite difficult. Frame caching consumes too much memory and remember under Win32 each process can use up to 2G memory.
And sorry for my words on DGIndex. But i really hope avisynth should be replaced by something new(maybe avisynth 3 could?).
survivant001
3rd December 2008, 18:19
If the video is standard definition MPEG-2, use Project X (http://project-x.sourceforge.net/) to fix the file before processing it further. Unfortunately most of the builds on the web are over two years old, so if you need latest features and fixes, you may need to build it from CVS yourself.
Further information and links to binaries (jars) are here: http://avidemux.org/admWiki/index.php?title=Project_X
thanks. I already compile it. I'll try tonight.
laserfan
3rd December 2008, 22:39
Well, not everybody is willing to read a guide first, just to convert a few videos...
I *really* disagree with this. Anyone who uses any piece of software with an expectation of a certain result should absolutely study at least the ReadMe and QuickStart guides before doing anything at all. If they're not will to do that, they belong somewhere else than doom9.org.
So my point stands: While Avisynth is a powerful software that servers well for many people (and isn't that hard to learn for most people), still it's not the most convenient solution for everybody's needs...
I'm not a programmer, can't call myself an "expert" with video in any way, but if there is ANYTHING I've learned in hanging around doom9 for a few years it's this: There is not now, nor will there Ever Be, anything resembling a "most convenient solution for everybody's needs"!!! My gosh everyone has different source and is looking for different output & results!!!! :p
Although I do understand your point, and except that Avisynth is still mostly a mystery to me, I very much appreciate that for what I want to do IT WORKS, and works every time, (mostly) without question. Further, that all the clear & wonderful docs associated with DGMPGDec have enabled me to learn enough to process some pretty bizarre TV broadcasts, for conversion and playback on my various media players, is something for which I am very grateful to Mr. Graft here!
:thanks:
LoRd_MuldeR
3rd December 2008, 22:59
I *really* disagree with this. Anyone who uses any piece of software with an expectation of a certain result should absolutely study at least the ReadMe and QuickStart guides before doing anything at all. If they're not will to do that, they belong somewhere else than doom9.org.
Again: To use Avisynth you will have to read guides and you'll need to get a basic understanding of how scripting works. You really can't compare this to reading a "Readme" file! My entire point was that not everybody is willing to learn how to use Avisynth, just for converting a few videos. There are many people that are missing the basic technical knowledge to learn how to use Avisynth easily. If you give an Avisynth guide to such people, they will be really confused and they'll have a hard time to understand it. In fact we must assume that the average user (not the average Doom9 member) has zero idea about scripting and is not interested to learn it. It would be ignorant to insist that everybody either has to learn Avisynth scripting or shouldn't be able to edit/convert videos. And, as mentioned before, we have a great number of "One Click" GUI's available that can be used without any previous knowledge and without having to study any guides. Select source file, select output file, click "Convert", done. Last but not least just because a user starts with a very simple and basic GUI, doesn't mean he/she will stick with that until forever. Rome wasn't built in a day either. The longer you work with video encoding, the more details will be of interest for you. And finally you may require an "advanced" tool, such as Avisynth, to get the desired results. So maybe you'll take your time to learn it then...
Guest
3rd December 2008, 23:02
MeGUI+AviSynth was my next try, but the mass of options just blew me away. No chance I could use that. Just import the presets and select one. You don't have to muck about with any option other than that.
@laserfan
Thanks for kind words.
rica
4th December 2008, 01:25
attention, this is a totally beginner's question (from a not-so-beginner).
Dunno why but i remembered to read the first post again :)
No need to avs knowledge i think. Just MeGui is enough- btw don't forget to install AviSynth 2.5 before-
MeGui > tools
1) D2V creator creates d2v
2) AviSynth Script creator creates "horrible" :) avs using this d2v.
3) Save and open this avs on MeGui
4) Select x264 DXVA-SD HQ preset or any other SD profile
5) Select "auto encode"
teddg
4th December 2008, 02:51
MeGUI+AviSynth was my next try, but the mass of options just blew me away. No chance I could use that.
Hi Lonely, you should give MeGUI another try. Just follow one of the guides at http://mewiki.project357.com/wiki/Main_Page. MeGUI has a tool to create the AviSynth script for you. After you've done a few encodes everything gets easy.
I've tried most of the free encoders out there and MeGUI is my favorite for backup purposes.
rica
4th December 2008, 03:02
Thanks for the contribution; this explains more detailed what i say.
roozhou
4th December 2008, 10:43
Dunno why but i remembered to read the first post again :)
No need to avs knowledge i think. Just MeGui is enough- btw don't forget to install AviSynth 2.5 before-
MeGui > tools
1) D2V creator creates d2v
2) AviSynth Script creator creates "horrible" :) avs using this d2v.
3) Save and open this avs on MeGui
4) Select x264 DXVA-SD HQ preset or any other SD profile
5) Select "auto encode"
You need to install .NET before using MeGUI. That takes a long time.
And mencoder could probably finished encoding before you launch MeGUI.
kemuri-_9
4th December 2008, 16:31
You need to install .NET before using MeGUI. That takes a long time.
And mencoder could probably finished encoding before you launch MeGUI.
true megui needs .net, but so do plenty of other things, they probably already have it.
and you really need to stop spreading nonsense around for the purpose of promoting your own agenda.
roozhou
4th December 2008, 17:57
true megui needs .net, but so do plenty of other things, they probably already have it.
and you really need to stop spreading nonsense around for the purpose of promoting your own agenda.
Do you think every encoding should use avisynth and any non-avisynth way is nonsense?
I am not promoting anything. I am telling people they have other convenient ways besides avisynth.
kemuri-_9
4th December 2008, 18:13
Do you think every encoding should use avisynth and any non-avisynth way is nonsense?
I am not promoting anything. I am telling people they have other convenient ways besides avisynth.
And mencoder could probably finished encoding before you launch MeGUI.
obviously you're promoting being anti-avisynth by spreading these kinds of these lies...
and that's enough of throwing this thread OT by me.
Atak_Snajpera
4th December 2008, 18:15
true megui needs .net, but so do plenty of other things,
For example Ati Catalyst :)
You need to install .NET before using MeGUI. That takes a long time.
And mencoder could probably finished encoding before you launch MeGUI.
Vista has .NET installed by default. Windows 7 will also have .NET.
MeGUI+AviSynth was my next try, but the mass of options just blew me away. No chance I could use that.
You should really try RipBot264!
roozhou
4th December 2008, 18:34
obviously you're promoting being anti-avisynth by spreading these kinds of these lies...
and that's enough of throwing this thread OT by me.
Plz point out in which thread i was telling lies.
Guest
4th December 2008, 20:00
Please take OT arguments to PM please. Thank you.
rica
5th December 2008, 01:21
You need to install .NET before using MeGUI. That takes a long time.
And mencoder could probably finished encoding before you launch MeGUI.
I don't think i was answering to your question.
Guest
5th December 2008, 03:01
Last warning, guys, stay on topic. Confine bickering to PM.
LonelyPixel
7th December 2008, 01:15
Soo many replies... okay, I just tried with Avidemux, and I must say I like it. Nice, clean, understandable user interface, that's how it should be. No need to mess around with script functions or commandline arguments from lengthy reference manuals when you can have a "list of forms" that just ask the necessary questions. Basically this works very well, the video gets encoded just the way I had imagined it, plus the ability to apply filters to my liking.
I still have a problem with audio processing though. Copy mode works fine, although I suppose there's a time offset (my current video doesn't allow for a clear judgement). But when I want to convert to AAC with 96 or 128 kbps or MP3 at 96 kbps (haven't tried others), the sound plays at half speed only.
PS: I'm a (.NET) software developer so .NET is installed in several versions here. ;) And yes, of course I could learn something like AviSynth or cmdline arguments, but I'm pretty sure I'd forget them very soon when I only use them like four times a year and there's two new versions every time in between.
LoRd_MuldeR
7th December 2008, 01:30
I still have a problem with audio processing though. Copy mode works fine, although I suppose there's a time offset (my current video doesn't allow for a clear judgement). But when I want to convert to AAC with 96 or 128 kbps or MP3 at 96 kbps (haven't tried others), the sound plays at half speed only.
Yes, you must set up the proper delay. If you don't do that, Avidemux will assume a delay of 0 ms, which may be wrong for you file.
Have a look at "Audio" -> "Main Track" to see the delay detected by Avidemux. But in my experience this isn't very reliable, unfortunately.
I usually use DGIndex to detect the audio delay of MPEG-2 files, which isn't the most convenient way, but works very precise...
LonelyPixel
7th December 2008, 01:49
That option says 0 ms delay. Well, need to try on another file. Still transcoding audio produces complete garbage. It plays only half of the normal speed, but the video plays correctly.
LoRd_MuldeR
7th December 2008, 01:52
That option says 0 ms delay. Well, need to try on another file. Still transcoding audio produces complete garbage. It plays only half of the normal speed, but the video plays correctly.
What version of Avidemux do you use? What is the selected output container/format ???
If you don't use the latest build (currently r4499), please update (http://avidemux.razorbyte.com.au/#avidemux2.4) and try again. If it only happens with one container (e.g. MP4), try another one (AVI, MKV, OGM, etc).
LonelyPixel
7th December 2008, 12:26
avidemux_2.4_r4499_win32, MP4 output. Also the case with MKV output. And so with AVI.
LoRd_MuldeR
7th December 2008, 15:02
avidemux_2.4_r4499_win32, MP4 output. Also the case with MKV output. And so with AVI.
What player do you use?
LonelyPixel
7th December 2008, 15:34
Media Player Classic 6.4.9.1
Windows XP SP3
very recent ffdshow build
LoRd_MuldeR
7th December 2008, 15:40
Media Player Classic 6.4.9.1
Windows XP SP3
very recent ffdshow build
Does the same playback problem occur with MPlayer or VLC Player :confused:
And could you provide short sample?
LonelyPixel
7th December 2008, 15:53
Also happens with VLC 0.9.6 win32. I couldn't find a recommended MPlayer build for Windows.
I noticed that when playing my TS recording file in Avidemux right from the beginning, it plays the sound correctly for the first few seconds. Then another show begins and Avidemux also plays the sound at half speed. So it's probably not the player but Avidemux itself that understands the input file wrong.
LoRd_MuldeR
7th December 2008, 15:55
I couldn't find a recommended MPlayer build for Windows.
http://mulder.dummwiedeutsch.de/home/?page=projects#mplayer ;)
I noticed that when playing my TS recording file in Avidemux right from the beginning, it plays the sound correctly for the first few seconds. Then another show begins and Avidemux also plays the sound at half speed. So it's probably not the player but Avidemux itself that understands the input file wrong.
Try to run your TS file through ProjectX before processing it in Avidemux, as recommended in the Avidemux Wiki:
* http://avidemux.org/admWiki/index.php?title=Editing_MPEG_capture_%28DVB_or_IVTV%29
* http://avidemux.org/admWiki/index.php?title=Project_X
LonelyPixel
7th December 2008, 21:51
I have used ProjectX to convert the TS file into m2v/mp2 files and loaded them into Avidemux. That's a bit of a tricky process because I needed to load the m2v video (drag & drop, easy) and then add the separate audio file later. Of course the open dialogue was not preset to the video file's directory so I had to search it first.
But still it doesn't help: playing the video it has correct sound at the beginning and too slow later.
The TS file is 1.2 GB large. How can I provide you a sample of the first few seconds, which is enough to test it? My video processing equipment isn't the most extensive, but so is the choice. (Not including non-free software which may or may not work 'freely'.) Would it e.g. be okay to simply truncate the file at a certain number of bytes? (I could write a little programme for that.)
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.