Version: 2020.3
동영상 소스
비디오 파일 이해

비디오 파일 호환성

You can import many video file formats into Unity. Unity stores imported video files as VideoClip assets.

For Unity to preview video files, the files must be compatible with the platform where you run the Unity Editor. Your files must also be compatible with the target build platforms. Unity provides options for transcoding files to commonly supported formats, but you can also manage compatibility yourself. See Compatibility with target platforms below for more information.

에디터 플랫폼과의 호환성

Video source files must use a format that your Editor platform supports. Each platform supports different video file formats.

확장자 Windows macOS Linux
.asf
.avi
.dv
.m4v
.mov
.mp4
.mpg
.mpeg
.ogv
.vp8
.webm
.wmv

Encoding for video file tracks must use a supported codec. Each platform supports specific codecs that can change with each version of the platform.

Video files that use unsupported codecs trigger an error message in the Editor and you must convert them to a compatible codec before you can use them.

H.264 is the optimal supported video codec for most platforms. It offers the best cross-platform compatibility, but the Linux Editor doesn’t support this codec.

For Linux, the optimal encoding is a .webm container with the following codecs:

For information about codec support, see the official platform documentation for your Editor. See the links below for codec compatibility for Windows and macOS:

Video Clip Importer

The Video Clip Importer can transcode video files that you import into Unity. This is useful when your videos use a codec that the Editor platform supports, but the files aren’t compatible with your target platform.

Using unsupported video files in the Editor

To use video files that are compatible with your target platforms, but not your Editor platform, set them up as streaming assets. For example, you might want to use the VP9 codec for an Android build, even though the Editor only supports VP8.

To set video files up as streaming assets, place them in the StreamingAssets folder of your project. Use the URL property to point the Video Player component to streaming assets.

You can also use Application.streamingAssetsPath to access platform-specific paths to streaming assets via scripts. You can’t preview these paths in the Editor.

If you want to have placeholder versions that are compatible with your Editor but use a different version for your target platform, you can include both versions in your project, use Editor-compatible versions as placeholders, and decide which version to use at run time.

아래 예제에서는 플랫폼별로 다양한 비디오 URL을 사용하는 방법을 보여줍니다. 자세한 내용은 플랫폼 기반 컴파일 문서를 참조하십시오.

void SetupMovieFile(VideoPlayer vp)
{
# if UNITY_EDITOR || UNITY_LINUX
vp.url = pathToMyVp8File;
# elif UNITY_ANDROID
vp.url = pathToMyVp9File;
# elif UNITY_STANDALONE_WIN
vp.url = pathToMyWmvFile;
# else
vp.url = pathToMyMp4File;
# endif
}

타겟 플랫폼과의 호환성

The Video Player component uses the native audio and video decoding libraries of your Editor platform to play video files in the Editor. You must confirm that the files also meet the requirements for the target platform.

인코딩 권장 사항

  • 하드웨어 가속을 위해 지원되는 최고의 네이티브 방식 비디오 코덱은 H.264입니다.

  • When cross-platform support is a high priority, VP8 is a good choice. It’s widely supported and has a comprehensive feature set, but it consumes more resources than hardware-accelerated codecs such as H.264.

  • H.265는 지원되는 기기에서만 사용할 수 있습니다. 자세한 내용은 아래의 H.265 호환성을 참조하십시오.

  • Android supports VP8 using native libraries, so VP8 might also be hardware-assisted on some Android devices.

  • The Unity Editor supports the .ogv format, but it isn’t widely supported on other platforms. Transcode .ogv files into .mp4 (H.264) or .webm (VP8) depending on the target platform.

주요 인코딩 값

The table below lists key values to look for in your encoding parameters: |파라미터 | 설명 | |:—|:—| |Video Codec| H.264, H.265 or VP8.| |Resolution|The resolution of your display. For example: 1280 × 720.| |Profile| The profile is a set of capabilities and constraints, often specified by the vendor, such as Baseline or Main. Applies to H.264/H.265.See H.264 or H.265. |Profile Level| Applies for H.264/H.265. Within a given profile, the level specifies performance requirements, for example, Baseline 3.1.| |Audio Codec| AAC (for mp4 videos using H.264/H.265) or Vorbis (for webm videos using VP8).| |Audio Channels| Dependent on the platform. Refer to the developer guide for your platform. For example, the article on Supported media formats for Android.

비디오 클립 변환

비디오 클립 임포터는 비디오 클립 에셋을 다음 비디오 코덱 중 하나로 변환하기 위한 옵션을 제공합니다.

변환된 비디오 클립은 자동으로 적절한 오디오 코덱을 사용합니다.

  • AAC videos encoded with H.264 or H.265
  • Vorbis for videos encoded with VP8
참고:
The Video Clip Importer provides only basic transcoding options. Depending on how your source files are encoded, you might not get optimal performance from clips transcoded with the importer options. In that case, you might get better results with an external transcoding program.

Encoding VideoClips with an external program

If you use videos that the target system definitely supports, you can leave the Video Clip Importer’s transcoding options disabled. If disabled, Unity doesn’t modify the files. You can manage encoding with an external program, which allows for finer control.

호환성 참고사항

This section provides useful information about video compatibility, and links to external resources.

미디어 지원에 대한 공급업체 권장 사항

Follow vendor recommendations for codec support. On older mobile platforms, codec choices are limited . You might need to inspect and convert or re-encode videos that you intend to include in a game running on multiple devices.

H.265 호환성

The table below provides platform-specific requirements and information for the H.265 codec.

플랫폼 요구 사항 Encoding/Decoding 참고
macOS SDK 10.13+ 하드웨어 인코딩: 6세대 Intel Core 프로세서

소프트웨어 인코딩: 모든 Mac

하드웨어 디코딩: 6세대 Intel Core 프로세서

소프트웨어 디코딩: 모든 Mac
Windows Windows 10 + HEVC 확장 기능 인코더

디코더
HEVC 확장 기능(하드웨어만 해당)

HEVC 확장 기능(하드웨어 + 소프트웨어 지원)
iOS SDK 11.0+ 하드웨어 디코딩: A9 칩

소프트웨어 디코딩: 모든 iOS 기기
tvOS SDK 11.0+
UWP Windows 10+ If a device lists support for H.265, that might not apply to all devices within the device family.
Android 5.0+

  • 2019–05–07 페이지 수정됨

  • Unity 5.6의 새로운 기능

동영상 소스
비디오 파일 이해