📜 ⬆️ ⬇️

Video rip. Part 3. Squeeze and pack

Content


  1. DVD preparation
    1. vStrip
    2. DGMPGDec

  2. Video processing
    1. What is interlace and what it is eaten with
    2. How to determine what we have: progressive, interlaced or telecined?
    3. Getting rid of ordinary interlacing (deinterlace)
    4. IVTC

  3. Squeeze and pack


The last article of their series “Video rip”. I am even a little sad that everything is over, but I finally closed the gestalt and now I won’t dream about how the habra people ask me to finish the job.

image
')
Today we will learn how best to compress, to which format, which container to use and which utilities. This part will be the easiest and to some extent general education.

So, to begin with, let's define some terms.

A container is such a thing where we can put video and / or audio, which is compressed by some algorithm. Examples of popular containers are AVI, MKV, MP4, OGM. In the same container can be streams of different formats.

Compression Algorithm (Format) - an algorithm that compresses video or audio, which will then be placed in a container.
Examples of video compression formats:
- MPEG-4 AVC [aka H.264] (implementations of encoders: x264, Apple H.264, Videosoft H.264, Elecard H.264, Intel IPP H.264, MainConcept H.264, etc.);
- MPEG-4 ASP (encoder implementations: DivX, XviD, libavcodec, etc.);
- Ogg Theora (coder implementation: libtheora).
Examples of audio compression formats:
- MPEG Layer-3 [aka MP3] (implementations of coders: LAME, Fraunhofer IIS MPEG Layer-3 Audio, etc.);
- MPEG-4 AAC (implementations of coders: Apple AAC, FAAC, etc.);
- AC3 [aka Dolby Digital, A / 52] (implementations of coders: liba52 others);
- Ogg Vorbis (libvorbis).

Some streams cannot be put in some containers. For example, without various tricks, you will not be able to shove H.264 into AVI. Here, for example, in the matryoshka (MKV) you can shove almost everything.

Compression

I recommend that you always use H.264 compression to compress the video stream. As a specific implementation of the H.264 coder, I chose an open-source x264. Those who say: “Here's the HD-video they need to compress only, but the rest is not necessary, enough XviD”, - I think, is fundamentally wrong.

H.264 compared to MPEG-4 ASP (DivX / XviD) is the next generation compression standard. Specifically, x264 has a bunch, just a ton of settings that allow you to compress any video, very finely adjusting the hardware required for decoding and encoding. You can set the settings in such a way that the same video can slow down, or maybe not.

Maybe it will sound bold, but XviD, DivX and others like them have died, leave them for backward compatibility, but do not compress anything else with them.

For coding, I recommend MeGUI . If you read the previous parts, you probably downloaded it yourself. Describe how to work in it, I think it makes no sense. If desired, it is easy to find manuals in Russian, but even there without manuals everything is clear. They specified the input file, indicated the output, chose the encoding profile, which are complete and pressed the button.

Another thing, if you wanted to finely adjust the settings. In general, I wanted to make a separate article on them, but in the comments they threw a link where someone describes all the parameters of H.264 very well. Use. Part 1 . Part 2 . Part 3 Part 4 Part 5 .

Container

Three types of containers are now popular: AVI, MKV and MP4. If the first one, I hope, will soon die, then the last two have shown themselves very well.

For tamping content in MP4, use the MP4Box program, to which there is a good Yamb front end . How to use Yamb is even embarrassing to describe, everything is clear there and even if there were no signatures to the buttons. :)

For MKV, mkvtoolnix is used. I was also not going to write how to use it, but in the previous part I promised to show how to use the time stamps generated by TIVTC. Yes, and the picture is needed, and then something posts without pictures recently I have at all.

Where there is a red arrow, you need to specify the path to the file that will generate TIVTC.

image

And yet, the nesting doll has one cool chip. Suppose you have an anamorphic video. This is the one that is stored on a DVD in resolution, for example, 720x480, but when outputting it is stretched by the player to a 16: 9 ratio. Those who encode, often for lack of knowledge, apply filters to change the frame size. But it is not necessary.

It is best to encode the video in the resolution in which it is stored on DVD, and then, in the properties of the matryoshka, when assembling the resulting video file, specify the desired ratio or resolution.

Good players that support MKV will automatically stretch the video. Moreover, if the player is really good, then in the settings you can choose the algorithm for which resize will be made.

It is much better than to make a video at the coding stage.

This is done like this.

image

On this, perhaps all. See you again! (:

The text contains edits from mvgolubev

Source: https://habr.com/ru/post/88668/


All Articles