• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Movie类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.googlecode.mp4parser.authoring.Movie的典型用法代码示例。如果您正苦于以下问题:Java Movie类的具体用法?Java Movie怎么用?Java Movie使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Movie类属于com.googlecode.mp4parser.authoring包,在下文中一共展示了Movie类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: calculateFragmentDurations

import com.googlecode.mp4parser.authoring.Movie; //导入依赖的package包/类
/**
 * Calculates the length of each fragment in the given <code>track</code> (as part of <code>movie</code>).
 *
 * @param track target of calculation
 * @param movie the <code>track</code> must be part of this <code>movie</code>
 * @return the duration of each fragment in track timescale
 */
public long[] calculateFragmentDurations(Track track, Movie movie) {
    long[] startSamples = intersectionFinder.sampleNumbers(track, movie);
    long[] durations = new long[startSamples.length];
    int currentFragment = 0;
    int currentSample = 1; // sync samples start with 1 !

    for (TimeToSampleBox.Entry entry : track.getDecodingTimeEntries()) {
        for (int max = currentSample + l2i(entry.getCount()); currentSample < max; currentSample++) {
            // in this loop we go through the entry.getCount() samples starting from current sample.
            // the next entry.getCount() samples have the same decoding time.
            if (currentFragment != startSamples.length - 1 && currentSample == startSamples[currentFragment + 1]) {
                // we are not in the last fragment && the current sample is the start sample of the next fragment
                currentFragment++;
            }
            durations[currentFragment] += entry.getDelta();


        }
    }
    return durations;

}
 
开发者ID:begeekmyfriend,项目名称:mp4parser_android,代码行数:30,代码来源:AbstractManifestWriter.java


示例2: getChunkSizes

import com.googlecode.mp4parser.authoring.Movie; //导入依赖的package包/类
/**
 * Gets the chunk sizes for the given track.
 *
 * @param track
 * @param movie
 * @return
 */
int[] getChunkSizes(Track track, Movie movie) {

    long[] referenceChunkStarts = intersectionFinder.sampleNumbers(track, movie);
    int[] chunkSizes = new int[referenceChunkStarts.length];


    for (int i = 0; i < referenceChunkStarts.length; i++) {
        long start = referenceChunkStarts[i] - 1;
        long end;
        if (referenceChunkStarts.length == i + 1) {
            end = track.getSamples().size();
        } else {
            end = referenceChunkStarts[i + 1] - 1;
        }

        chunkSizes[i] = l2i(end - start);
        // The Stretch makes sure that there are as much audio and video chunks!
    }
    assert DefaultMp4Builder.this.track2Sample.get(track).size() == sum(chunkSizes) : "The number of samples and the sum of all chunk lengths must be equal";
    return chunkSizes;


}
 
开发者ID:begeekmyfriend,项目名称:mp4parser_android,代码行数:31,代码来源:DefaultMp4Builder.java


示例3: build

import com.googlecode.mp4parser.authoring.Movie; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public IsoFile build(Movie movie) {
    LOG.fine("Creating movie " + movie);
    IsoFile isoFile = new IsoFile();


    isoFile.addBox(createFtyp(movie));
    isoFile.addBox(createMoov(movie));

    for (Box box : createMoofMdat(movie)) {
        isoFile.addBox(box);
    }
    isoFile.addBox(createMfra(movie, isoFile));

    return isoFile;
}
 
开发者ID:begeekmyfriend,项目名称:mp4parser_android,代码行数:19,代码来源:FragmentedMp4Builder.java


示例4: createTrex

import com.googlecode.mp4parser.authoring.Movie; //导入依赖的package包/类
protected Box createTrex(Movie movie, Track track) {
    TrackExtendsBox trex = new TrackExtendsBox();
    trex.setTrackId(track.getTrackMetaData().getTrackId());
    trex.setDefaultSampleDescriptionIndex(1);
    trex.setDefaultSampleDuration(0);
    trex.setDefaultSampleSize(0);
    SampleFlags sf = new SampleFlags();
    if ("soun".equals(track.getHandler())) {
        // as far as I know there is no audio encoding
        // where the sample are not self contained.
        sf.setSampleDependsOn(2);
        sf.setSampleIsDependedOn(2);
    }
    trex.setDefaultSampleFlags(sf);
    return trex;
}
 
开发者ID:begeekmyfriend,项目名称:mp4parser_android,代码行数:17,代码来源:FragmentedMp4Builder.java


示例5: convertM4a

import com.googlecode.mp4parser.authoring.Movie; //导入依赖的package包/类
private void convertM4a(String inFilePath, String title, String artist)
{
    String path = inFilePath.substring(0, inFilePath.lastIndexOf("/"));
    try {
        Movie inAudio = MovieCreator.build(inFilePath);
        Container out = new DefaultMp4Builder().build(inAudio);

        if (title != null && artist != null) {
            writeMetaData(out, artist, title);
        }
        long currentMillis = System.currentTimeMillis();
        FileOutputStream fos = new FileOutputStream(new File(path + TEMP_FILE_NAME + currentMillis + ".m4a"));
        out.writeContainer(fos.getChannel());
        fos.close();
        File inFile = new File(inFilePath);
        if (inFile.delete()) {
            File tempOutFile = new File(path + TEMP_FILE_NAME + currentMillis + ".m4a");
            tempOutFile.renameTo(inFile);
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
开发者ID:teocci,项目名称:YouTube-In-Background,代码行数:24,代码来源:DownloadFinishedReceiver.java


示例6: mergeMp4

import com.googlecode.mp4parser.authoring.Movie; //导入依赖的package包/类
private void mergeMp4(String inFilePathAudio, String inFilePathVideo)
{
    String path = inFilePathVideo.substring(0, inFilePathVideo.lastIndexOf("/"));
    try {
        Movie video = MovieCreator.build(inFilePathVideo);
        Movie audio = MovieCreator.build(inFilePathAudio);
        video.addTrack(audio.getTracks().get(0));
        Container out = new DefaultMp4Builder().build(video);
        long currentMillis = System.currentTimeMillis();
        FileOutputStream fos = new FileOutputStream(new File(path + TEMP_FILE_NAME + currentMillis + ".mp4"));
        out.writeContainer(fos.getChannel());
        fos.close();
        File inAudioFile = new File(inFilePathAudio);
        inAudioFile.delete();
        File inVideoFile = new File(inFilePathVideo);
        if (inVideoFile.delete()) {
            File tempOutFile = new File(path + TEMP_FILE_NAME + currentMillis + ".mp4");
            tempOutFile.renameTo(inVideoFile);
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
开发者ID:teocci,项目名称:YouTube-In-Background,代码行数:24,代码来源:DownloadFinishedReceiver.java


示例7: startMuteUsingMp4Parser

import com.googlecode.mp4parser.authoring.Movie; //导入依赖的package包/类
private static void startMuteUsingMp4Parser(String filePath,
        SaveVideoFileInfo dstFileInfo) throws FileNotFoundException, IOException {
    File dst = dstFileInfo.mFile;
    File src = new File(filePath);
    RandomAccessFile randomAccessFile = new RandomAccessFile(src, "r");
    Movie movie = MovieCreator.build(randomAccessFile.getChannel());

    // remove all tracks we will create new tracks from the old
    List<Track> tracks = movie.getTracks();
    movie.setTracks(new LinkedList<Track>());

    for (Track track : tracks) {
        if (track.getHandler().equals("vide")) {
            movie.addTrack(track);
        }
    }
    writeMovieIntoFile(dst, movie);
    randomAccessFile.close();
}
 
开发者ID:asm-products,项目名称:nexus-gallery,代码行数:20,代码来源:VideoUtils.java


示例8: writeMovieIntoFile

import com.googlecode.mp4parser.authoring.Movie; //导入依赖的package包/类
private static void writeMovieIntoFile(File dst, Movie movie)
        throws IOException {
    if (!dst.exists()) {
        dst.createNewFile();
    }

    IsoFile out = new DefaultMp4Builder().build(movie);
    FileOutputStream fos = new FileOutputStream(dst);
    FileChannel fc = fos.getChannel();
    out.getBox(fc); // This one build up the memory.

    fc.close();
    fos.close();
}
 
开发者ID:asm-products,项目名称:nexus-gallery,代码行数:15,代码来源:VideoUtils.java


示例9: mergeAudioFile

import com.googlecode.mp4parser.authoring.Movie; //导入依赖的package包/类
private void mergeAudioFile(File recordedFile, File recordedFileTemp) throws IOException {
    if (!recordedFile.exists()) {
        recordedFileTemp.renameTo(new File(LocalMediaStorage.getOutputMediaFileUri(null, LocalMediaStorage.MEDIA_TYPE_AUDIO_RECORD).getPath()));
        return;
    }
    final Movie movieA = MovieCreator.build(new FileDataSourceImpl(recordedFileTemp));
    final Movie movieB = MovieCreator.build(new FileDataSourceImpl(recordedFile));
    final Movie finalMovie = new Movie();
    final List<Track> movieOneTracks = movieA.getTracks();
    final List<Track> movieTwoTracks = movieB.getTracks();
    //for (int i = 0; i < movieOneTracks.size() || i < movieTwoTracks.size(); ++i) {
        finalMovie.addTrack(new AppendTrack(movieTwoTracks.get(0), movieOneTracks.get(0)));
    //}
    final Container container = new DefaultMp4Builder().build(finalMovie);
    File recordedFileMerged = new File(LocalMediaStorage.getOutputMediaFileUri(null, LocalMediaStorage.MEDIA_TYPE_AUDIO_RECORD_MERGED).getPath());
    if (recordedFileMerged.exists()) {
        recordedFileMerged.delete();
    }
    final FileOutputStream fos = new FileOutputStream(new File(String.format(recordedFileMerged.getPath())));
    final WritableByteChannel bb = Channels.newChannel(fos);
    container.writeContainer(bb);
    fos.close();
    recordedFile.delete();
    recordedFileTemp.delete();
    recordedFileMerged.renameTo(new File(LocalMediaStorage.getOutputMediaFileUri(null, LocalMediaStorage.MEDIA_TYPE_AUDIO_RECORD).getPath()));
}
 
开发者ID:andreaslorentzen,项目名称:Dansk-Datahistorisk-Forening,代码行数:27,代码来源:AudioRecorder.java


示例10: makeMP4

import com.googlecode.mp4parser.authoring.Movie; //导入依赖的package包/类
/**
 * Creates an MP4 file out of encoded h.264 bytes.
 * 
 * @throws IOException
 */
public static void makeMP4() throws IOException {
	H264TrackImpl h264Track = new H264TrackImpl(new FileDataSourceImpl("dump.h264"));
	//AACTrackImpl aacTrack = new AACTrackImpl(new FileInputStream("/home/sannies2/Downloads/lv.aac").getChannel());
	Movie m = new Movie();
	m.addTrack(h264Track);
	//m.addTrack(aacTrack);
	Container out = new DefaultMp4Builder().build(m);
	FileOutputStream fos = new FileOutputStream(new File("h264_output.mp4"));
	FileChannel fc = fos.getChannel();
	out.writeContainer(fc);
	fos.close();
}
 
开发者ID:mondain,项目名称:h264app,代码行数:18,代码来源:H264Main.java


示例11: muxerFileDebug

import com.googlecode.mp4parser.authoring.Movie; //导入依赖的package包/类
public static void muxerFileDebug(){
	try 
	{
		File input = new File(SDCardUtils.getExternalSdCardPath() + "/a.h264");
		File output = new File(SDCardUtils.getExternalSdCardPath() + "/b.mp4");

		H264TrackImpl h264Track = new H264TrackImpl(new FileDataSourceImpl(input), "eng", UriParser.videoQuality.framerate, 1);
		Movie m = new Movie();
		m.addTrack(h264Track);
		m.setMatrix(Matrix.ROTATE_90);
		Container out = new DefaultMp4Builder().build(m);
		MovieHeaderBox mvhd = Path.getPath(out, "moov/mvhd");
   		mvhd.setMatrix(Matrix.ROTATE_90);
		TrackBox trackBox  = Path.getPath(out, "moov/trak");
		TrackHeaderBox tkhd = trackBox.getTrackHeaderBox();
		tkhd.setMatrix(Matrix.ROTATE_90);
		FileChannel fc = new FileOutputStream(output.getAbsolutePath()).getChannel();
		out.writeContainer(fc);
		fc.close();

	} 
	catch (IOException e) {
	    Log.e("test", "some exception", e);
	}	
}
 
开发者ID:xunboo,项目名称:JJCamera,代码行数:26,代码来源:MP4Muxer.java


示例12: convertM4a

import com.googlecode.mp4parser.authoring.Movie; //导入依赖的package包/类
private void convertM4a(String inFilePath, String title, String artist) {
    String path = inFilePath.substring(0, inFilePath.lastIndexOf("/"));
    try {
        Movie inAudio = MovieCreator.build(inFilePath);
        Container out = new DefaultMp4Builder().build(inAudio);

        if (title != null && artist != null) {
            writeMetaData(out, artist, title);
        }
        long currentMillis = System.currentTimeMillis();
        FileOutputStream fos = new FileOutputStream(new File(path + TEMP_FILE_NAME + currentMillis + ".m4a"));
        out.writeContainer(fos.getChannel());
        fos.close();
        File inFile = new File(inFilePath);
        if (inFile.delete()) {
            File tempOutFile = new File(path + TEMP_FILE_NAME + currentMillis + ".m4a");
            tempOutFile.renameTo(inFile);
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
开发者ID:vyasgiridhar,项目名称:Youtube-Downloader,代码行数:23,代码来源:DownloadFinishedReceiver.java


示例13: mergeMp4

import com.googlecode.mp4parser.authoring.Movie; //导入依赖的package包/类
private void mergeMp4(String inFilePathAudio, String inFilePathVideo) {
    String path = inFilePathVideo.substring(0, inFilePathVideo.lastIndexOf("/"));
    try {
        Movie video = MovieCreator.build(inFilePathVideo);
        Movie audio = MovieCreator.build(inFilePathAudio);
        video.addTrack(audio.getTracks().get(0));
        Container out = new DefaultMp4Builder().build(video);
        long currentMillis = System.currentTimeMillis();
        FileOutputStream fos = new FileOutputStream(new File(path + TEMP_FILE_NAME + currentMillis + ".mp4"));
        out.writeContainer(fos.getChannel());
        fos.close();
        File inAudioFile = new File(inFilePathAudio);
        inAudioFile.delete();
        File inVideoFile = new File(inFilePathVideo);
        if (inVideoFile.delete()) {
            File tempOutFile = new File(path + TEMP_FILE_NAME + currentMillis + ".mp4");
            tempOutFile.renameTo(inVideoFile);
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
开发者ID:vyasgiridhar,项目名称:Youtube-Downloader,代码行数:23,代码来源:DownloadFinishedReceiver.java


示例14: crop

import com.googlecode.mp4parser.authoring.Movie; //导入依赖的package包/类
private boolean crop() {
  try {
    // オリジナル動画を読み込み
    String filePath = Environment.getExternalStorageDirectory() + "/sample1.mp4";
    Movie originalMovie = MovieCreator.build(filePath);

    // 分割
    Track track = originalMovie.getTracks().get(0);
    Movie movie = new Movie();
    movie.addTrack(new AppendTrack(new CroppedTrack(track, 200, 400)));

    // 出力
    Container out = new DefaultMp4Builder().build(movie);
    String outputFilePath = Environment.getExternalStorageDirectory() + "/output_crop.mp4";
    FileOutputStream fos = new FileOutputStream(new File(outputFilePath));
    out.writeContainer(fos.getChannel());
    fos.close();
  } catch (Exception e) {
    e.printStackTrace();
    return false;
  }
  return true;
}
 
开发者ID:suwa-yuki,项目名称:Mp4ParserSample,代码行数:24,代码来源:MainActivity.java


示例15: append

import com.googlecode.mp4parser.authoring.Movie; //导入依赖的package包/类
public static void append(
        final String firstFile,
        final String secondFile,
        final String newFile) throws IOException {
    final Movie movieA = MovieCreator.build(new FileDataSourceImpl(secondFile));
    final Movie movieB = MovieCreator.build(new FileDataSourceImpl(firstFile));

    final Movie finalMovie = new Movie();

    final List<Track> movieOneTracks = movieA.getTracks();
    final List<Track> movieTwoTracks = movieB.getTracks();

    for (int i = 0; i < movieOneTracks.size() || i < movieTwoTracks.size(); ++i) {
        finalMovie.addTrack(new AppendTrack(movieTwoTracks.get(i), movieOneTracks.get(i)));
    }

    final Container container = new DefaultMp4Builder().build(finalMovie);

    final FileOutputStream fos = new FileOutputStream(new File(String.format(newFile)));
    final WritableByteChannel bb = Channels.newChannel(fos);
    container.writeContainer(bb);
    fos.close();
}
 
开发者ID:EnteriseToolkit,项目名称:paperchains,代码行数:24,代码来源:Mp4ParserWrapper.java


示例16: calculateFragmentDurations

import com.googlecode.mp4parser.authoring.Movie; //导入依赖的package包/类
/**
 * Calculates the length of each fragment in the given <code>track</code> (as part of <code>movie</code>).
 *
 * @param track target of calculation
 * @param movie the <code>track</code> must be part of this <code>movie</code>
 * @return the duration of each fragment in track timescale
 */
public long[] calculateFragmentDurations(Track track, Movie movie) {
    long[] startSamples = intersectionFinder.sampleNumbers(track);
    long[] durations = new long[startSamples.length];
    int currentFragment = 0;
    int currentSample = 1; // sync samples start with 1 !

    for (long delta : track.getSampleDurations()) {
        for (int max = currentSample + 1; currentSample < max; currentSample++) {
            // in this loop we go through the entry.getCount() samples starting from current sample.
            // the next entry.getCount() samples have the same decoding time.
            if (currentFragment != startSamples.length - 1 && currentSample == startSamples[currentFragment + 1]) {
                // we are not in the last fragment && the current sample is the start sample of the next fragment
                currentFragment++;
            }
            durations[currentFragment] += delta;


        }
    }
    return durations;

}
 
开发者ID:sannies,项目名称:mp4parser-smooth-streaming,代码行数:30,代码来源:AbstractManifestWriter.java


示例17: saveTracks

import com.googlecode.mp4parser.authoring.Movie; //导入依赖的package包/类
private static void saveTracks(String filePath, Track... tracks) throws IOException {
    Movie movie = new Movie();
    for (Track track: tracks) {
        movie.addTrack(track);
    }
    saveMovie(movie, filePath);
}
 
开发者ID:AndyZhu1991,项目名称:grafika,代码行数:8,代码来源:Mp4Util.java


示例18: removeUnknownTracks

import com.googlecode.mp4parser.authoring.Movie; //导入依赖的package包/类
private Movie removeUnknownTracks(Movie source) {
    Movie nuMovie = new Movie();
    for (Track track : source.getTracks()) {
        if ("vide".equals(track.getHandler()) || "soun".equals(track.getHandler())) {
            nuMovie.addTrack(track);
        } else {
            LOG.fine("Removed track " + track);
        }
    }
    return nuMovie;
}
 
开发者ID:begeekmyfriend,项目名称:mp4parser_android,代码行数:12,代码来源:FlatPackageWriterImpl.java


示例19: correctTimescale

import com.googlecode.mp4parser.authoring.Movie; //导入依赖的package包/类
/**
 * Returns a new <code>Movie</code> in that all tracks have the timescale 10000000. CTS & DTS are modified
 * in a way that even with more than one framerate the fragments exactly begin at the same time.
 *
 * @param movie
 * @return a movie with timescales suitable for smooth streaming manifests
 */
public Movie correctTimescale(Movie movie) {
    Movie nuMovie = new Movie();
    for (Track track : movie.getTracks()) {
        nuMovie.addTrack(new ChangeTimeScaleTrack(track, timeScale, ismvBuilder.getFragmentIntersectionFinder().sampleNumbers(track, movie)));
    }
    return nuMovie;

}
 
开发者ID:begeekmyfriend,项目名称:mp4parser_android,代码行数:16,代码来源:FlatPackageWriterImpl.java


示例20: build

import com.googlecode.mp4parser.authoring.Movie; //导入依赖的package包/类
public static Movie build(ReadableByteChannel channel) throws IOException {
    IsoFile isoFile = new IsoFile(channel);
    Movie m = new Movie();
    List<TrackBox> trackBoxes = isoFile.getMovieBox().getBoxes(TrackBox.class);
    for (TrackBox trackBox : trackBoxes) {
        m.addTrack(new Mp4TrackImpl(trackBox));
    }
    return m;
}
 
开发者ID:begeekmyfriend,项目名称:mp4parser_android,代码行数:10,代码来源:MovieCreator.java



注:本文中的com.googlecode.mp4parser.authoring.Movie类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AudioPlayerManager类代码示例发布时间:2022-05-21
下一篇:
Java Tuple类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap