Jump to content

Convert MPEG4 to H264


Erik
Go to solution Solved by Carlo,

Recommended Posts

Erik

Hi,

I am trying to convert some AVI videos (MPEG4/MP3) to a more friendly format. So i was trying out the convert feature...I choose Custom/MKV/H264/AAC,mp3,ac3/Original Quality. The conversion finishes just fine, everything about the files are identical except f the original AVI file was 700mb (bitrate of 1,431) and the new file MKV file is 1647mb (bitrate of 3711).

Now I have very little knowledge of video compression, but does this sound right? should the H264 file be about twice the size of the MPEG4 one?

Thanks

Link to comment
Share on other sites

seanbuff
55 minutes ago, crusher11 said:

MPEG4 and AVI are containers, not codecs.

 

In this instance, the containers are AVI and MKV ...MPEG4 is absolutely a codec.

Link to comment
Share on other sites

pwhodges

MPEG-4 is a complete system of codecs and associated paraphernalia.  MPEG-4 part 3 is AAC for audio; MPEG-4 part 10 is AVC for video, which is identical with the ITU standard H.264; MPEG-4 part 12 is the little-used picture format known as JPEG-2000; MPEG-4 part 14 defines the container format we commonly call MP4.

You say you are starting with MPEG4 in AVI.  This is unusual, because it requires a hack to the specification, is is not universally supported.  But if you genuinely have that, then MKVToolnix will repackage it in an MKV container without transcoding, thus not changing the size apart from the different container overhead.

The size of a transcoded file can be larger or smaller than the original depending on the parameter settings provided to the encoder.

Paul

  • Like 1
Link to comment
Share on other sites

Erik

Thanks @pwhodges the files are from an old tv series “JAG”. When I open an episode with MKVToolNix GUI it shows the  Container as AVI and the Codecs as MPEG-4p2 and MP3.

I did try using MKVToolNix to swap the container to MKV (which completes just fine), but playback is extremely choppy on my Roku and that’s why I was trying to find a solution to move away from the avi and MPEG4 codec to a more universally accepted h264.

So I guess I’m trying to see what the best method to do this conversion is, doubling the size made me think something isn’t set right. Is there a better way?

Link to comment
Share on other sites

pwhodges

MPEG-4 part 2 is four years prior to part 10; it contains a standard which is roughly equivalent to h.263.  You may well need to transcode it to h.264 to improve playback.  Try converting a file using Handbrake, and see if that solves your problem; I would not expect a big increase in size with the default parameter settings, but it's quite easy to play (the CRF setting is the main one).

Paul

Link to comment
Share on other sites

Erik

Thanks again, I’ll try handbrake (never used it before), will the default settings maintain quality of the original?

i don’t mind changing all the files, just want to maintain the original quality the best I can.

Link to comment
Share on other sites

pwhodges
10 minutes ago, Erik said:

 will the default settings maintain quality of the original?

That depends what the original quality is!  But the defaults are a sensible starting point.  If you judge it's equivalent, increase the CRF (lower quality) and try again, until you find where the visible change occurs - then balance that against the resulting size.  In general lower resolution files justify a lower CRF (higher quality) to make the best of their limitations.

Paul

  • Like 1
Link to comment
Share on other sites

Erik

Thanks. The quality is not very high to begin with!  624x352 with a bitrate of 1500 and says level 5...hence not wanting to loose quality from what is already low!

Link to comment
Share on other sites

  • Solution

Another tool you might want to check out is Xmedia Recode.  It can do remuxing or conversions and is point and click.

It's easy to use as well to remove audio tracks not needed, etc..

It's my "Swiss knife" conversion program I recommend to people on Windows.

  • Like 1
Link to comment
Share on other sites

Erik

Wow @cayars I have never come across that program before and its great! Its simple and powerful and is set to maintain the quality of the source video almost right off the bat.

The same file (700mb) coverted to MKV/H264/MP3 is now 740mb but all the right formats, which is way more reasonable then emby's build in covert which ended up at 1600mb!

 

Link to comment
Share on other sites

Yea, it's really nice.  I love the UI on it as it's super easy IMHO to use for people.

Don't know how much you've played with it yet but you can queue up a whole workload of different files to process and then it do it's thing.

Link to comment
Share on other sites

Erik

I just tested a couple files first to make sure i was doing it right (just trying the 2-pass for added quality now) and then it looked like i can just add all 227 episodes and have them all process as a batch/queue which would be much better than having to do every file manually one at a time!

Link to comment
Share on other sites

negativzeroe

I use this.

You can set up watch folders then create your preset however you like then just drop it in a folder.

The only hurdle would be learning containers but I had already converted my server. Emby for instance is running in a container.

Link to comment
Share on other sites

  • 2 months later...
zebo51
On 6/12/2020 at 1:51 PM, cayars said:

Another tool you might want to check out is Xmedia Recode.  It can do remuxing or conversions and is point and click.

It's easy to use as well to remove audio tracks not needed, etc..

It's my "Swiss knife" conversion program I recommend to people on Windows.

I'm pretty much new to this and have a few questions.  I installed the program above.  For output format it defaulted to Custom I think and I just chose format as Matroska(mkv).  That was all I changed.  I did a test file that was 713MB.  The result was 497MB.  The file did play fine though.  Looks like on the video tab it defaulted to 1500 bit rate which was lower and maybe hence the smaller file size.

Should it automatically match to source bit rate?  Or is there a way to have that auto for batch files?

Below is the media info for the avi file, what would be good settings for the conversion?

Format                                   : AVI
Format/Info                              : Audio Video Interleave
File size                                : 697 MiB
Duration                                 : 41 min 35 s
Overall bit rate                         : 2 342 kb/s
Writing application                      : Lavf58.35.100

Video
ID                                       : 0
Format                                   : xvid
Codec ID                                 : xvid
Duration                                 : 41 min 34 s
Bit rate                                 : 2 200 kb/s
Width                                    : 640 pixels
Height                                   : 360 pixels
Display aspect ratio                     : 16:9
Frame rate                               : 29.970 (30000/1001) FPS
Bits/(Pixel*Frame)                       : 0.319
Stream size                              : 654 MiB (94%)

Audio
ID                                       : 1
Format                                   : MPEG Audio
Format version                           : Version 1
Format profile                           : Layer 3
Format settings                          : Joint stereo / MS Stereo
Codec ID                                 : 55
Codec ID/Hint                            : MP3
Duration                                 : 41 min 35 s
Bit rate mode                            : Constant
Bit rate                                 : 128 kb/s
Channel(s)                               : 2 channels
Sampling rate                            : 48.0 kHz
Compression mode                         : Lossy
Stream size                              : 38.1 MiB (5%)
Alignment                                : Aligned on interleaves
Interleave, duration                     : 24  ms (0.72 video frame)
Interleave, preload duration             : 72  ms
Writing library                          : LAME3.100

 

 

 

Link to comment
Share on other sites

1 hour ago, zebo51 said:

I'm pretty much new to this and have a few questions.  I installed the program above.  For output format it defaulted to Custom I think and I just chose format as Matroska(mkv).  That was all I changed.  I did a test file that was 713MB.  The result was 497MB.  The file did play fine though.  Looks like on the video tab it defaulted to 1500 bit rate which was lower and maybe hence the smaller file size.

Try these settings which will switch to constant quality.

 

aaa.png

Link to comment
Share on other sites

zebo51
30 minutes ago, cayars said:

Try these settings which will switch to constant quality.

 

aaa.png

So that made a really small file and the video lost a lot of detail.  Here is the before and after.

 

image.png.9645e9b905b5c9253f7ae53398e173bf.png

=======================================================================================================

 

image.png.9be51942783e1a46b317ff2a41a1bff1.png

 

 

 

Link to comment
Share on other sites

The Quality setting will depend on the media or source quality.  Lower number = more quality.

28 is the default for Bluray

23 for DVD

18 to 20 for SD

I for example personally use 23 for BR, 18 for DVD and SD

So try dropping that number down to match the source.

 

Link to comment
Share on other sites

zebo51
1 hour ago, cayars said:

The Quality setting will depend on the media or source quality.  Lower number = more quality.

28 is the default for Bluray

23 for DVD

18 to 20 for SD

I for example personally use 23 for BR, 18 for DVD and SD

So try dropping that number down to match the source.

 

Ok, will give that a try.  Also just noticed that it made it B&W.  Using your settings from above.

Link to comment
Share on other sites

zebo51

Great, a few hundred shows and many many hours later I have converted most.  A couple of the avi's got missed.  They play on my PC, but when I try and open them in xmedia, it acts like it is adding them and then nothing.  Tried drag and drop and file open.  No errors or anything.  Anyway to figure out why?

Thanks

Link to comment
Share on other sites

When xmedia won't touch the file it's usually corrupted from my experience.

Link to comment
Share on other sites

pwhodges

None the less, it's probably worth trying other programs.  Remuxing in MKVToolnix might help, or converting in Handbrake might work.

Paul

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...