Учебник по ffmpeg и SDL Урок 2: Вывод на экран

Fabrice Bellard, Martin Bohme, “An ffmpeg and SDL Tutorial Tutorial 02: Outputting to the Screen”, public translation into Russian from English More about this translation.

See also 209 similar translations

Translate into another language.

Participants

VlKhomenko1131 points
Join Translated.by to translate! If you already have a Translated.by account, please sign in.
If you do not want to register an account, you can sign in with OpenID.
Pages: ← previous Ctrl next next untranslated
1 2 3 4

An ffmpeg and SDL Tutorial Tutorial 02: Outputting to the Screen

Учебник по ffmpeg и SDL
Урок 2: Вывод на экран

History of edits (Latest: VlKhomenko 1 year, 6 months ago) §

SDL and Video

SDL и видео

History of edits (Latest: VlKhomenko 1 year, 6 months ago) §

To draw to the screen, we're going to use SDL. SDL stands for Simple Direct Layer, and is an excellent library for multimedia, is cross-platform, and is used in several projects. You can get the library at the official website or you can download the development package for your operating system if there is one. You'll need the libraries to compile the code for this tutorial (and for the rest of them, too).

Для вывода на экран мы будем использовать SDL. SDL аббревиатура для Simple Direct Layer и это отличная мультимедиа библиотека — кросплатформенная, используемая во многих проектах. Вы можете взять её с оффициального web-сайта или скачать пакет разработки для своей операционной системы. Вам необходима данная библиотека для компиляции кода из этого урока (и последующих).

History of edits (Latest: VlKhomenko 1 year, 6 months ago) §

SDL has many methods for drawing images to the screen, and it has one in particular that is meant for displaying movies on the screen - what it calls a YUV overlay. YUV (technically not YUV but YCbCr) * A note: There is a great deal of annoyance from some people at the convention of calling "YCbCr" "YUV". Generally speaking, YUV is an analog format and YCbCr is a digital format. ffmpeg and SDL both refer to YCbCr as YUV in their code and macros. is a way of storing raw image data like RGB. Roughly speaking, Y is the brightness (or "luma") component, and U and V are the color components. (It's more complicated than RGB because some of the color information is discarded, and you might have only 1 U and V sample for every 2 Y samples.) SDL's YUV overlay takes in a raw array of YUV data and displays it. It accepts 4 different kinds of YUV formats, but YV12 is the fastest. There is another YUV format called YUV420P that is the same as YV12, except the U and V arrays are switched. The 420 means it is subsampled at a ratio of 4:2:0, basically meaning there is 1 color sample for every 4 luma samples, so the color information is quartered. This is a good way of saving bandwidth, as the human eye does not percieve this change. The "P" in the name means that the format is "planar" — simply meaning that the Y, U, and V components are in separate arrays. ffmpeg can convert images to YUV420P, with the added bonus that many video streams are in that format already, or are easily converted to that format.

SDL имеет много методов для вывода изображений на экран, и в частности для отображения видео, для этой цели используется так называемый YUV оверлей. YUV (с технической точки зрения точнее сказать не YUV, а YCbCr) - это способ хранения исходных данных изображения способом, похожим на RGB. Грубо говоря, Y- компонент содержит значение яркости, U и V - цветовые компоненты. (Это более сложная модель, чем RGB, потому что информация о некоторых цветах отбрасывается, и вы можете иметь только по 1 U и V компоненту на каждые 2 Y образца.) SDL YUV оверлей берет исходный массив YUV данных и отображает его. Он принимает 4 различных видов YUV форматов, из которых самый быстрый - YV12. существует ещё один формат - YUV420P, во многом схожий с YV12, за исключением того, что массивы U и V переставлены. 420 означает, что это компоненты находятся в соотношении 4:2:0, то есть 1 значение цвета приходится на 4 значения яркости, таким образом информация о цвете разделенна на четыер значения. Это хороший способ экономии места, так как человеческий глаз не замечает это изменение. "P" в названии означает, что формат "плоский" , то есть значения Y, U и V компонентов содержаться в виде отдельных массивов. ffmpeg в качестве дополнительной возможности может конвертировать изображения в YUV420P, хотя многие видео потоки уже имеют этот формат, или легко могут быть к нему приведены.
* примечание: не всем нравится, когда происходит некоторая путаница этих форматов: "YCbCr" и "YUV". Вообще говоря, YUV-аналоговый формат, а YCbCr - это цифровой. ffmpeg и SDL используют в исходном коде YUV как синоним YCbCr.

History of edits (Latest: VlKhomenko 1 year ago) §
Pages: ← previous Ctrl next next untranslated
1 2 3 4

© Copyright (c) 2003 Fabrice Bellard, and a tutorial by Martin Bohme.. License: Creative Commons Attribution-Share Alike 2.5