IT. Expert System.

Android Reference

VideoEditor


android.media.videoeditor

Interface VideoEditor

  • All Known Implementing Classes:
    VideoEditorImpl


    public interface VideoEditor
    This is the interface implemented by classes which provide video editing functionality. The VideoEditor implementation class manages all input and output files. Unless specifically mentioned, methods are blocking. A typical editing session may consist of the following sequence of operations:
    • Add a set of MediaItems
    • Apply a set of Transitions between MediaItems
    • Add Effects and Overlays to media items
    • Preview the movie at any time
    • Save the VideoEditor implementation class internal state
    • Release the VideoEditor implementation class instance by invoking release()
    The internal VideoEditor state consists of the following elements:
    • Ordered & trimmed MediaItems
    • Transition video clips
    • Overlays
    • Effects
    • Audio waveform for the background audio and MediaItems
    • Project thumbnail
    • Last exported movie.
    • Other project specific data such as the current aspect ratio.
    • Field Detail

      • DURATION_OF_STORYBOARD

        static final int DURATION_OF_STORYBOARD
        Use this value instead of the specific end of the storyboard timeline value.
        See Also:
        Constant Field Values
      • MAX_SUPPORTED_FILE_SIZE

        static final long MAX_SUPPORTED_FILE_SIZE
        Maximum supported file size
        See Also:
        Constant Field Values
    • Method Detail

      • getPath

        String getPath()
        Returns:
        The path where the VideoEditor stores all files related to the project
      • release

        void release()
        This method releases all in-memory resources used by the VideoEditor instance. All pending operations such as preview, export and extract audio waveform must be canceled.
      • save

        void save()
                  throws IOException
        Persist the current internal state of VideoEditor to the project path. The VideoEditor state may be restored by invoking the VideoEditorFactory#load(String) method. This method does not release the internal in-memory state of the VideoEditor. To release the in-memory state of the VideoEditor the release() method must be invoked. Pending transition generations must be allowed to complete before the state is saved. Pending audio waveform generations must be allowed to complete. Pending export operations must be allowed to continue.
        Throws:
        IOException - if the internal state cannot be saved to project file
      • export

        void export(String filename,
                  int height,
                  int bitrate,
                  VideoEditor.ExportProgressListener listener)
                    throws IOException
        Create the output movie based on all media items added and the applied storyboard items. This method can take a long time to execute and is blocking. The application will receive progress notifications via the ExportProgressListener. Specific implementations may not support multiple simultaneous export operations. Note that invoking methods which would change the contents of the output movie throw an IllegalStateException while an export operation is pending. The audio and video codecs are automatically selected by the underlying implementation.
        Parameters:
        filename - The output file name (including the full path)
        height - The height of the output video file. The supported values for height are described in the MediaProperties class, for example: HEIGHT_480. The width will be automatically computed according to the aspect ratio provided by setAspectRatio(int)
        bitrate - The bitrate of the output video file. This is approximate value for the output movie. Supported bitrate values are described in the MediaProperties class for example: BITRATE_384K
        listener - The listener for progress notifications. Use null if export progress notifications are not needed.
        Throws:
        IllegalArgumentException - if height or bitrate are not supported or if the audio or video codecs are not supported
        IOException - if output file cannot be created
        IllegalStateException - if a preview or an export is in progress or if no MediaItem has been added
        CancellationException - if export is canceled by calling #cancelExport()
        UnsupportOperationException - if multiple simultaneous export() are not allowed
      • export

        void export(String filename,
                  int height,
                  int bitrate,
                  int audioCodec,
                  int videoCodec,
                  VideoEditor.ExportProgressListener listener)
                    throws IOException
        Create the output movie based on all media items added and the applied storyboard items. This method can take a long time to execute and is blocking. The application will receive progress notifications via the ExportProgressListener. Specific implementations may not support multiple simultaneous export operations. Note that invoking methods which would change the contents of the output movie throw an IllegalStateException while an export operation is pending.
        Parameters:
        filename - The output file name (including the full path)
        height - The height of the output video file. The supported values for height are described in the MediaProperties class, for example: HEIGHT_480. The width will be automatically computed according to the aspect ratio provided by setAspectRatio(int)
        bitrate - The bitrate of the output video file. This is approximate value for the output movie. Supported bitrate values are described in the MediaProperties class for example: BITRATE_384K
        audioCodec - The audio codec to be used for the export. The audio codec values are defined in the MediaProperties class (e.g. ACODEC_AAC_LC). Note that not all audio codec types are supported for export purposes.
        videoCodec - The video codec to be used for the export. The video codec values are defined in the MediaProperties class (e.g. VCODEC_H264). Note that not all video codec types are supported for export purposes.
        listener - The listener for progress notifications. Use null if export progress notifications are not needed.
        Throws:
        IllegalArgumentException - if height or bitrate are not supported or if the audio or video codecs are not supported
        IOException - if output file cannot be created
        IllegalStateException - if a preview or an export is in progress or if no MediaItem has been added
        CancellationException - if export is cancelled by calling #cancelExport()
        UnsupportOperationException - if multiple simultaneous export() are not allowed
      • cancelExport

        void cancelExport(String filename)
        Cancel the running export operation. This method blocks until the export is cancelled and the exported file (if any) is deleted. If the export completed by the time this method is invoked, the export file will be deleted.
        Parameters:
        filename - The filename which identifies the export operation to be canceled.
      • addMediaItem

        void addMediaItem(MediaItem mediaItem)
        Add a media item at the end of the storyboard.
        Parameters:
        mediaItem - The media item object to add
        Throws:
        IllegalStateException - if a preview or an export is in progress or if the media item id is not unique across all the media items added.
      • insertMediaItem

        void insertMediaItem(MediaItem mediaItem,
                           String afterMediaItemId)
        Insert a media item after the media item with the specified id.
        Parameters:
        mediaItem - The media item object to insert
        afterMediaItemId - Insert the mediaItem after the media item identified by this id. If this parameter is null, the media item is inserted at the beginning of the timeline.
        Throws:
        IllegalStateException - if a preview or an export is in progress
        IllegalArgumentException - if media item with the specified id does not exist (null is a valid value) or if the media item id is not unique across all the media items added.
      • moveMediaItem

        void moveMediaItem(String mediaItemId,
                         String afterMediaItemId)
        Move a media item after the media item with the specified id. Note: The project thumbnail is regenerated if the media item is or becomes the first media item in the storyboard timeline.
        Parameters:
        mediaItemId - The id of the media item to move
        afterMediaItemId - Move the media item identified by mediaItemId after the media item identified by this parameter. If this parameter is null, the media item is moved at the beginning of the timeline.
        Throws:
        IllegalStateException - if a preview or an export is in progress
        IllegalArgumentException - if one of media item ids is invalid (null is a valid value)
      • removeMediaItem

        MediaItem removeMediaItem(String mediaItemId)
        Remove the media item with the specified id. If there are transitions before or after this media item, then this/these transition(s) are removed from the storyboard. If the extraction of the audio waveform is in progress, the extraction is canceled and the file is deleted. Effects and overlays associated with the media item will also be removed. Note: The project thumbnail is regenerated if the media item which is removed is the first media item in the storyboard or if the media item is the only one in the storyboard. If the media item is the only one in the storyboard, the project thumbnail will be set to a black frame and the aspect ratio will revert to the default aspect ratio and this method is equivalent to removeAllMediaItems() in this case.
        Parameters:
        mediaItemId - The unique id of the media item to be removed
        Returns:
        The media item that was removed
        Throws:
        IllegalStateException - if a preview or an export is in progress
        IllegalArgumentException - if media item with the specified id does not exist
      • removeAllMediaItems

        void removeAllMediaItems()
        Remove all media items in the storyboard. All effects, overlays and all transitions are also removed. Note: The project thumbnail will be set to a black frame and the aspect ratio will revert to the default aspect ratio.
        Throws:
        IllegalStateException - if a preview or an export is in progress
      • getAllMediaItems

        List<MediaItem> getAllMediaItems()
        Get the list of media items in the order in which it they appear in the storyboard timeline. Note that if any media item source files are no longer accessible, this method will still provide the full list of media items.
        Returns:
        The list of media items. If no media item exist an empty list will be returned.
      • getMediaItem

        MediaItem getMediaItem(String mediaItemId)
        Find the media item with the specified id
        Parameters:
        mediaItemId - The media item id
        Returns:
        The media item with the specified id (null if it does not exist)
      • addTransition

        void addTransition(Transition transition)
        Add a transition between the media items specified by the transition. If a transition existed at the same position it is invalidated and then the transition is replaced. Note that the new transition video clip is not automatically generated by this method. The Transition.generate() method must be invoked to generate the transition video clip. Note that the TransitionAtEnd and TransitionAtStart are special kinds that can not be applied between two media items. A crossfade audio transition will be automatically applied regardless of the video transition.
        Parameters:
        transition - The transition to apply
        Throws:
        IllegalStateException - if a preview or an export is in progress
        IllegalArgumentException - if the transition duration is larger than the smallest duration of the two media item files or if the two media items specified in the transition are not adjacent
      • removeTransition

        Transition removeTransition(String transitionId)
        Remove the transition with the specified id.
        Parameters:
        transitionId - The id of the transition to be removed
        Returns:
        The transition that was removed
        Throws:
        IllegalStateException - if a preview or an export is in progress
        IllegalArgumentException - if transition with the specified id does not exist
      • getAllTransitions

        List<Transition> getAllTransitions()
        Get the list of transitions
        Returns:
        The list of transitions. If no transitions exist an empty list will be returned.
      • getTransition

        Transition getTransition(String transitionId)
        Find the transition with the specified transition id.
        Parameters:
        transitionId - The transition id
        Returns:
        The transition
      • addAudioTrack

        void addAudioTrack(AudioTrack audioTrack)
        Add the specified AudioTrack to the storyboard. Note: Specific implementations may support a limited number of audio tracks (e.g. only one audio track)
        Parameters:
        audioTrack - The AudioTrack to add
        Throws:
        UnsupportedOperationException - if the implementation supports a limited number of audio tracks.
        IllegalArgumentException - if media item is not unique across all the audio tracks already added.
      • insertAudioTrack

        void insertAudioTrack(AudioTrack audioTrack,
                            String afterAudioTrackId)
        Insert an audio track after the audio track with the specified id. Use addAudioTrack to add an audio track at the end of the storyboard timeline.
        Parameters:
        audioTrack - The audio track object to insert
        afterAudioTrackId - Insert the audio track after the audio track identified by this parameter. If this parameter is null the audio track is added at the beginning of the timeline.
        Throws:
        IllegalStateException - if a preview or an export is in progress
        IllegalArgumentException - if media item with the specified id does not exist (null is a valid value). if media item is not unique across all the audio tracks already added.
        UnsupportedOperationException - if the implementation supports a limited number of audio tracks
      • moveAudioTrack

        void moveAudioTrack(String audioTrackId,
                          String afterAudioTrackId)
        Move an AudioTrack after the AudioTrack with the specified id.
        Parameters:
        audioTrackId - The id of the AudioTrack to move
        afterAudioTrackId - Move the AudioTrack identified by audioTrackId after the AudioTrack identified by this parameter. If this parameter is null the audio track is added at the beginning of the timeline.
        Throws:
        IllegalStateException - if a preview or an export is in progress
        IllegalArgumentException - if one of media item ids is invalid (null is a valid value)
      • removeAudioTrack

        AudioTrack removeAudioTrack(String audioTrackId)
        Remove the audio track with the specified id. If the extraction of the audio waveform is in progress, the extraction is canceled and the file is deleted.
        Parameters:
        audioTrackId - The id of the audio track to be removed
        Returns:
        The audio track that was removed
        Throws:
        IllegalStateException - if a preview or an export is in progress
      • getAllAudioTracks

        List<AudioTrack> getAllAudioTracks()
        Get the list of AudioTracks in order in which they appear in the storyboard. Note that if any AudioTrack source files are not accessible anymore, this method will still provide the full list of audio tracks.
        Returns:
        The list of AudioTracks. If no audio tracks exist an empty list will be returned.
      • getAudioTrack

        AudioTrack getAudioTrack(String audioTrackId)
        Find the AudioTrack with the specified id
        Parameters:
        audioTrackId - The AudioTrack id
        Returns:
        The AudioTrack with the specified id (null if it does not exist)
      • setAspectRatio

        void setAspectRatio(int aspectRatio)
        Set the aspect ratio used in the preview and the export movie. The default aspect ratio is ASPECTRATIO_16_9 (16:9).
        Parameters:
        aspectRatio - to apply. If aspectRatio is the same as the current aspect ratio, then this function just returns. The supported aspect ratio are defined in the MediaProperties class for example: ASPECTRATIO_16_9
        Throws:
        IllegalStateException - if a preview or an export is in progress
        IllegalArgumentException - if aspect ratio is not supported
      • getAspectRatio

        int getAspectRatio()
        Get current aspect ratio.
        Returns:
        The aspect ratio as described in MediaProperties
      • getDuration

        long getDuration()
        Get the preview (and output movie) duration.
        Returns:
        The duration of the preview (and output movie)
      • renderPreviewFrame

        long renderPreviewFrame(SurfaceHolder surfaceHolder,
                              long timeMs,
                              VideoEditor.OverlayData overlayData)
        Render a frame according to the preview aspect ratio and activating all storyboard items relative to the specified time.
        Parameters:
        surfaceHolder - SurfaceHolder used by the application
        timeMs - time corresponding to the frame to display
        overlayData - The overlay data
        Returns:
        The accurate time stamp of the frame that is rendered.
        Throws:
        IllegalStateException - if a preview or an export is already in progress
        IllegalArgumentException - if time is negative or beyond the preview duration
      • generatePreview

        void generatePreview(VideoEditor.MediaProcessingProgressListener listener)
        This method must be called after any changes made to the storyboard and before startPreview is called. Note that this method may block for an extensive period of time.
      • startPreview

        void startPreview(SurfaceHolder surfaceHolder,
                        long fromMs,
                        long toMs,
                        boolean loop,
                        int callbackAfterFrameCount,
                        VideoEditor.PreviewProgressListener listener)
        Start the preview of all the storyboard items applied on all MediaItems This method does not block (does not wait for the preview to complete). The PreviewProgressListener allows to track the progress at the time interval determined by the callbackAfterFrameCount parameter. The SurfaceHolder has to be created and ready for use before calling this method. The method is a no-op if there are no MediaItems in the storyboard.
        Parameters:
        surfaceHolder - SurfaceHolder where the preview is rendered.
        fromMs - The time (relative to the timeline) at which the preview will start
        toMs - The time (relative to the timeline) at which the preview will stop. Use -1 to play to the end of the timeline
        loop - true if the preview should be looped once it reaches the end
        callbackAfterFrameCount - The listener interface should be invoked after the number of frames specified by this parameter.
        listener - The listener which will be notified of the preview progress
        Throws:
        IllegalArgumentException - if fromMs is beyond the preview duration
        IllegalStateException - if a preview or an export is already in progress
      • stopPreview

        long stopPreview()
        Stop the current preview. This method blocks until ongoing preview is stopped. Ignored if there is no preview running.
        Returns:
        The accurate current time when stop is effective expressed in milliseconds
      • clearSurface

        void clearSurface(SurfaceHolder surfaceHolder)
        Clears the preview surface
        Parameters:
        surfaceHolder - SurfaceHolder where the preview is rendered and needs to be cleared.


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 791 / . Delta: 0.03835 с