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.
neuron2
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:
neuron2
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...
neuron2
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...
neuron2
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.
neuron2
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.
neuron2
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.)
nm
7th December 2008, 21:57
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.
ProjectX can also mux both streams to MPEG-TS.
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?
Cut with ProjectX.
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.)
That should also work well enough.
LonelyPixel
7th December 2008, 22:56
I have tried to convert the TS file to TS in ProjectX, but it would just do nothing and immediately report success. Not sure what it did there. But I can only operate the File,Add and QuickStart/prepare buttons, the rest looks a bit complicated...
Okay, I'll try to cut the file tomorrow and upload it for you.
PS: I'm currently converting a lengthier video from m2v/ac3 to x264/aac with Avidemux, once I've found a file that works and played a little with different bitrates/options. Strange thing: The file has 23 minutes. It reports 28 minutes elapsed, 21 minutes remaining and 24 frames/second. I only come to the result of 12 frames/second... Time goes linear, so the fps must be wrong. Strange programme, a little out of time: plays sound at half speed, computes double frame rates... :confused:
nm
7th December 2008, 23:11
PS: I'm currently converting a lengthier video from m2v/ac3 to x264/aac with Avidemux, once I've found a file that works and played a little with different bitrates/options. Strange thing: The file has 23 minutes. It reports 28 minutes elapsed, 21 minutes remaining and 24 frames/second. I only come to the result of 12 frames/second... Time goes linear, so the fps must be wrong. Strange programme, a little out of time: plays sound at half speed, computes double frame rates... :confused:
Well, these problems are probably related to each other and maybe triggered by your MPEG-TS streams, if that's what you used as source video in this attempt too.
LonelyPixel
8th December 2008, 07:10
No, the video with the wrong frame rate display while processing is perfectly fine. No audio problems here. That's only the other file.
nm
8th December 2008, 12:42
Audio playing at half speed and in other case video doing the same thing sounds related to me. Avidemux may be confused from something in the input and tries to keep sync either way.
But we'll see once you post samples of both source streams.
LonelyPixel
8th December 2008, 17:57
Sorry, how can I cut a video with ProjectX? I don't see how that should be possible. I'm using version 0.90.3 but it seems to be pretty recent... from 2006 or so. 0.90.4 doesn't work, it only comes as source and the build script fails. I'm now continuing to work on truncating the file.
nm
8th December 2008, 18:19
There are links to a pre-built 0.90.4 version (http://students.washington.edu/cdobrich/ProjectX_0.90.4.zip) at http://avidemux.org/admWiki/index.php?title=Project_X
The CVS version has a few fixes and new features, but you should be fine with 0.90.4.
To cut, launch ProjectX and File->Add the source file. Use the slider below the video preview image to select a position and the "+" button on a purple background at the center of the window to add a cut mark. For example, move to the beginning of the video, push the + button, move a few minutes forward and push it again. Now the cut view between the preview image and the position slider should show a green interval (which is kept while cutting) at the beginning of the video and red for the rest.
Then, push the "prepare ..." button to open the ProcessWindow. Select action "to TS" and press the play/pause button at top left. Output for "/path/to/input.ts" should be "/path/to/input.new.ts".
LonelyPixel
8th December 2008, 18:23
You can find the first TS example here:
http://unclassified.de/tmp/demo1_30mb.ts (30 MB)
I can observe the following behaviour with this file:
* When playing with MPC, everything is okay until ~ sec. 25 when the sound stops to play. (Not sure how well MPC can handle transport streams with changing audio codecs, if that's the case here.)
* When playing/processing with Avidemux, everything is okay until ~ sec. 25 when the sound continues to play at half speed. Both within Avidemux and any player that's to play the resulting file.
I cannot provide a sample of the file that leads to wrong processing status info (double processing frame rate displayed than actually working) because the TS has a leading of ~ 5 minutes that I've cut away, but the resulting file is m2v/ac3 which I'm not sure how to cut. Only to clarify things: Encoding and playback with that second file is perfectly okay, it's only the info displayed during the encoding process that's wrong. It displays ~ 24 fps but is only encoding at ~ 12 fps. Minor issue, not really relevant cause the time displayed (elapsed, remaining) seems accurate. Probably this info is wrong on all files.
nm
8th December 2008, 20:34
You can find the first TS example here:
http://unclassified.de/tmp/demo1_30mb.ts (30 MB)
I can observe the following behaviour with this file:
* When playing with MPC, everything is okay until ~ sec. 25 when the sound stops to play. (Not sure how well MPC can handle transport streams with changing audio codecs, if that's the case here.)
* When playing/processing with Avidemux, everything is okay until ~ sec. 25 when the sound continues to play at half speed. Both within Avidemux and any player that's to play the resulting file.
The audio gets changed from mono to stereo and seems that Avidemux can't handle that. HandBrake fails too, although a bit differently. MPlayer doesn't seem to have problems, so GUIs built on top of MEncoder may work better. However, such audio format changes only happen between programs, so if you separate the programs and cut commercials out, there should be no problems.
One way to work around this problem would be to demux video and audio with ProjectX and set it to decode MPEG audio to WAV (PreSettings->audio->decode MPEG Layer1,2 to PCM). Then load the .m2v video to Avidemux and add the .mp2.wav audio (Audio->Main Track).
You may want to report this bug if you continue to use Avidemux.
Only to clarify things: Encoding and playback with that second file is perfectly okay, it's only the info displayed during the encoding process that's wrong. It displays ~ 24 fps but is only encoding at ~ 12 fps. Minor issue, not really relevant cause the time displayed (elapsed, remaining) seems accurate. Probably this info is wrong on all files.
Okay, now I understood the issue, but I see the right fps. Did you notice that the fps and frame position displays are updated every half seconds, not every second?
LonelyPixel
8th December 2008, 21:35
Cutting programmes and commercials doesn't necessarily cut exactly at audio format or video aspect ratio changes. How can I even select multiple cuts in Avidemux? I only see one A and B markers, no cut list. Is there an alternative cut mode opposed to the single-scene mode that I can see right now? I.e. not selecting the region(s) to keep but instead the regions to cut out and keep all the rest. The latter mode is especially useful for cutting commercials. I think I'm gonna keep Avidemux for transcoding to x264 or something else, 'cause it's much better than DVDx. :) But I think I'm not going to transcode all my TV recordings. They're just good in MPEG-2, anything else is worse at similar or lower bitrates. So I'm going to further investigate Avidemux' capabilities in frame-accurate multi-cut MPEG-2 editing with that "Smart Copy" mode. TS/MPG in, MPG out.
Yes, the status is updated every 0.5 seconds. I have just tested it and the reported processing frame rate is exactly the double of what it's really doing.
nm
8th December 2008, 21:54
Cutting programmes and commercials doesn't necessarily cut exactly at audio format or video aspect ratio changes. How can I even select multiple cuts in Avidemux? I only see one A and B markers, no cut list. Is there an alternative cut mode opposed to the single-scene mode that I can see right now? I.e. not selecting the region(s) to keep but instead the regions to cut out and keep all the rest. The latter mode is especially useful for cutting commercials.
It cuts stuff out by default. Select region, Edit->Cut/Delete. Repeat.
I think I'm gonna keep Avidemux for transcoding to x264 or something else, 'cause it's much better than DVDx. :) But I think I'm not going to transcode all my TV recordings. They're just good in MPEG-2, anything else is worse at similar or lower bitrates.
x264 should be able to keep similar quality at significantly lower bitrates when the source is progressive or when you deinterlace it. (At least if you are happy with half-rate deinterlacing, for full 50/60 fps framerate it may be a better idea to keep the original source and deinterlace on playback).
Yes, the status is updated every 0.5 seconds. I have just tested it and the reported processing frame rate is exactly the double of what it's really doing.
Strange, I only tried CRF encoding though, maybe it works differently in 2-pass mode.
LonelyPixel
8th December 2008, 22:01
Edit,Cut - thanks.
I've encoded a TV-Recording to x264 with 2-pass, avg bitrate 3000 and 5000, pixel aspect ratio as input (was 16:9). The only filter is yadif in mode 1. Then I played the original and encoded video in MPC and paused at the very same frames to compare them in detail. I could find several situations where a lot of details were lost or softened in x264. The entire files with 3000/5000 kbps are 533/872 MB, the original m2v/ac3 is 1198 MB. Also, processing time takes 4x real time, on my now overclocked Core2Duo 1,8/2,3 GHz. Transcoding is good for giving smaller versions of recordings away, but for my personal "home cinema" (= desktop computer...) I can't justify the effort.
nm
8th December 2008, 22:48
I've encoded a TV-Recording to x264 with 2-pass, avg bitrate 3000 and 5000, pixel aspect ratio as input (was 16:9). The only filter is yadif in mode 1.
Yadif in mode 1 and 3 is a full-rate (bob) deinterlacer. 0 and 2 are half-rate. Bobbing is useful for keeping the motion fluidity of sports and live shows, but movies and newer TV series are usually progressive video originating from 24 fps film or digital sources. Deinterlacing progressive video is a waste of time, space and sometimes quality.
If you have lots of interlaced recordings, you could also try encoding them as interlaced. However, there may be signaling issues with the x264 library included in Avidemux. Some decoders expect additional SEI messages to deinterlace automatically (http://forum.doom9.org/showthread.php?t=137432) and this requires a patched x264.
It's also a good idea to use CRF instead of 2-pass mode if you don't need the output to be of certain size (to fit a DVD for example).
nm
9th December 2008, 01:38
I've encoded a TV-Recording to x264 with 2-pass, avg bitrate 3000 and 5000, pixel aspect ratio as input (was 16:9). The only filter is yadif in mode 1. Then I played the original and encoded video in MPC and paused at the very same frames to compare them in detail. I could find several situations where a lot of details were lost or softened in x264.
I played around a bit with Avidemux and your sample. The loss of details was probably caused by input postprocessing (mostly deblocking) which seems to be enabled by default in Avidemux for some reason. Your DVB source has quite good quality, so deblocking will only smooth details out. Disable horizontal and vertical deblocking in the video preferences tab and set the strength to 0. Then set the same values in current settings (Video->Postprocessing (F4)).
I did a few sample encodes (http://www.cs.helsinki.fi/u/mikkila/video/avidemux/) with high quality x264 settings (5-8 fps on a 2 GHz Core 2 Duo). Although encoding as interlaced is a bit more efficient than bobbing before encoding, I'm rather pleased with the 50 fps yadif=1 results at crf 23. That would be good enough for my taste: practically transparent when played back and takes less than half the space of the original MPEG-2. As to the crf 20 samples, I can see differences in the noise patterns compared to the original, but actual details aren't lost. The crf 26 sample can be easily told apart from the source, but it is still quite watchable, IMO. I would probably use crf 25 for less important stuff when encoding with yadif=1.
LonelyPixel
10th December 2008, 17:26
Yadif in mode 1 and 3 is a full-rate (bob) deinterlacer. 0 and 2 are half-rate. Bobbing is useful for keeping the motion fluidity of sports and live shows, but movies and newer TV series are usually progressive video originating from 24 fps film or digital sources.
What is half-/full-rate? And the shows I have recently recorded are all interlaced. All German DVB-S TV seems interlaced. Is there any TV station that's finally broadcasting SDTV with progressive encoding? Does that even work, I mean all traditional camera and TV equipment works interlaced. If anything would be transmitted progressive, it would break anything, right? So I wouldn't expect progressive encoding on TV until HDTV comes around, which is still far away.
If you have lots of interlaced recordings, you could also try encoding them as interlaced.
Yeah, doesn't work. I've tried myself and watched your samples: It doesn't run well at all on playback. Jumps around wildly.
It's also a good idea to use CRF instead of 2-pass mode if you don't need the output to be of certain size (to fit a DVD for example).
Okay, I'll try that again. CRF 20 looks promising. Not so much CRF 26...
LonelyPixel
10th December 2008, 17:30
Disable horizontal and vertical deblocking in the video preferences tab and set the strength to 0.
Done.
I'm rather pleased with the 50 fps yadif=1 results at crf 23
I see, I get a video with 50 fps when I use yadif mode=1? Your 50 fps samples look a considerably smoother (in motion, not picture details) than the 25 fps ones.
BTW, also with CRF encoding, the displayed process frame rate is too high. It just displayed me ~ 24 fps but was actually working at ~ 12 fps. Seems it doesn't come from 2-pass.
nm
10th December 2008, 19:11
I see, I get a video with 50 fps when I use yadif mode=1?
Yes. The output is 25 fps in modes 0 and 2 and 50 fps in modes 1 and 3 for a 25i source. In 25 fps modes, part of the temporal information from the interlaced source is lost.
BTW, also with CRF encoding, the displayed process frame rate is too high. It just displayed me ~ 24 fps but was actually working at ~ 12 fps. Seems it doesn't come from 2-pass.
I still haven't seen this. How do you calculate the correct fps? Does the same thing happen if you don't use any filters (especially yadif or other deinterlacers that may double the framerate).
LonelyPixel
10th December 2008, 19:23
Arr, you tell it. Of course I've calculated wrong... we have 50 fps in the resulting video, not 25 as in the source! Sure, then the displayed rate is correct. Stupid me.
So, converting from 25 fps to 50 fps during encoding is actually (almost) doubling the data volume, resulting in larger video files, correct?
nm
10th December 2008, 19:40
What is half-/full-rate? And the shows I have recently recorded are all interlaced. All German DVB-S TV seems interlaced. Is there any TV station that's finally broadcasting SDTV with progressive encoding? Does that even work, I mean all traditional camera and TV equipment works interlaced. If anything would be transmitted progressive, it would break anything, right? So I wouldn't expect progressive encoding on TV until HDTV comes around, which is still far away.
Well, here in Finland most movies and newer series that originate from 24 fps progressive sources are broadcast as 25 fps progressive video with speeded up audio. The MPEG-2 video may be coded as interlaced but both fields are from the same time position, so practically it's progressive and doesn't require actual deinterlacing, only weaving. There are no obvious interlacing patterns visible (faint blocky patterns may appear in flat areas if the bitrate is low, but these can be ignored).
24 fps film sources may also be pulled down for PAL (2:2:2:2:2:2:2:2:2:2:2:3). This may be rather annoying to reverse and requires an IVTC filter instead of a deinterlacer.
25i/50p stuff shot with video cameras is broadcast as interlaced 576i25. This includes some series, news, sports, live events and most commercials. Personally I rarely watch this stuff, so I just deinterlace the video to 25 fps and lose some of the motion fluidity.
Yeah, doesn't work. I've tried myself and watched your samples: It doesn't run well at all on playback. Jumps around wildly.
Apparently your player/decoder does deinterlace but it just gets the field order wrong. This could be fixed by swapping the fields with one of the Avidemux filters. However, some other player/decoder combination might still not work properly. The correct fix is harder to accomplish with Avidemux since one would need a custom-built libx264 and parameters for the field order exposed in the GUI.
nm
10th December 2008, 19:58
So, converting from 25 fps to 50 fps during encoding is actually (almost) doubling the data volume, resulting in larger video files, correct?
Yes, more bitrate is needed to keep the same quality within a frozen frame. However, such a straightforward comparison is not the whole truth since there is also more motion information in the 50 fps output. At higher bitrates, a 50 fps encode is much better than a 25 fps one even when both are done at the same bitrate.
If you are fine with choppier playback, use 25 fps. For example, talking heads probably don't require 50 fps but soccer may need it.
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.