DeepMedia logo
Open Source
Search...

Other versions of this page

Improve this page on GitHub

Search

Data Sources

Starting a transcoding operation will require a source for our data, which is not necessarily a File. The DataSource objects will automatically take care about releasing streams / resources, which is convenient but it means that they can not be used twice.

kotlin
Transcoder.into(filePath) .addDataSource(source1) .transcode()

Source Types

UriDataSource

The Android friendly source can be created with UriDataSource(context, uri) or simply using addDataSource(context, uri) in the transcoding builder.

FileDescriptorDataSource

A data source backed by a file descriptor. Use FileDescriptorDataSource(descriptor) or simply addDataSource(descriptor) in the transcoding builder. Note that it is the caller responsibility to close the file descriptor.

FilePathDataSource

A data source backed by a file absolute path. Use FilePathDataSource(path) or simply addDataSource(path) in the transcoding builder.

AssetFileDescriptorDataSource

A data source backed by Android's AssetFileDescriptor. Use AssetFileDescriptorDataSource(descriptor) or simply addDataSource(descriptor) in the transcoding builder. Note that it is the caller responsibility to close the file descriptor.

Track specific sources

Although a media source can have both audio and video, you can select a specific track for transcoding and exclude the other(s). For example, to select the video track only:

java
Transcoder.into(filePath) .addDataSource(TrackType.VIDEO, source) .transcode()
MethodDescription
addDataSource(Context, Uri)Adds a new source for the given Uri.
addDataSource(FileDescriptor)Adds a new source for the given FileDescriptor.
addDataSource(String)Adds a new source for the given file path.
addDataSource(DataSource)Adds a new source.
addDataSource(TrackType, DataSource)Adds a new source restricted to the given TrackType.

Subscribe to the DeepMedia Newsletter

The latest news about DeepMedia products, open source projects and software development at our company.

By clicking “Subscribe”, you agree that DeepMedia may use your email address to send you newsletters, including commercial communications, and to process your personal data for this purpose. You agree that DeepMedia may process said data using third-party services for this purpose in accordance with the DeepMedia Privacy Policy. You can revoke this consent at any time using the unsubscribe link included in each email or by writing at contact@deepmedia.io.