Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/200.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 除了使用FFMPEG和MP4Parser外,还有其他方法可以修剪视频吗?_Android_Android Ffmpeg_Mp4parser - Fatal编程技术网

Android 除了使用FFMPEG和MP4Parser外,还有其他方法可以修剪视频吗?

Android 除了使用FFMPEG和MP4Parser外,还有其他方法可以修剪视频吗?,android,android-ffmpeg,mp4parser,Android,Android Ffmpeg,Mp4parser,我使用FFMPEG进行视频剪辑,但它占用了太多的视频处理时间 String[] complexCommand = {"-ss", "" + startMs / 1000, "-y", "-i", yourRealPath, "-t", "" + (endMs - startMs) / 1000,"-vcodec", "mpeg4", "-b:v", "2097152", "-b:a", "48000", "-ac", "2", "-ar", "22050", filePath}; 同样也使用M

我使用FFMPEG进行视频剪辑,但它占用了太多的视频处理时间

String[] complexCommand = {"-ss", "" + startMs / 1000, "-y", "-i", yourRealPath, "-t", "" + (endMs - startMs) / 1000,"-vcodec", "mpeg4", "-b:v", "2097152", "-b:a", "48000", "-ac", "2", "-ar", "22050", filePath};
同样也使用MP4Parser,但有一段时间我遇到了问题。用于下面的lib

com.googlecode.mp4parser:isoparser:1.1.21
有没有其他方法可以修剪视频

像我的视频持续时间是20:00和修剪视频之间的06:00-09:00的持续时间

上面的示例是根据您给出的命令对视频进行重新编码。如果不需要对视频进行重新编码,可以使用,它直接将输入流复制到输出流。请注意,您不能严格保证获得精确的开始行为,因为您可能在该精确点没有所需的I帧或等效帧,或者编解码器必须向前或向后跳转才能找到。这种方法非常快,因为不需要进行编码工作,它只是从一个(文件)复制到另一个(文件)。在我的2018级笔记本电脑上,我花了约1.5秒的时间剪辑了3分钟的视频

$ time ffmpeg -hide_banner -y -i input.mpg -ss 6:00 -t 3:00 -c:v copy output.mpg      
[mpeg @ 0000024ffd46a740] start time for stream 0 is not set in estimate_timings_from_pts
Input #0, mpeg, from 'input.mpg':
  Duration: 00:29:57.45, start: 0.516689, bitrate: 4108 kb/s
    Stream #0:0[0x1bf]: Data: dvd_nav_packet
    Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, progressive), 1280x720 [SAR 1:1 DAR 16:9], 59.94 fps, 59.94 tbr, 90k tbn, 119.88 tbc
[mpeg @ 0000024ffd47d500] VBV buffer size not set, using default size of 230KB
If you want the mpeg file to be compliant to some specification
Like DVD, VCD or others, make sure you set the correct buffer size
Output #0, mpeg, to 'output.mpg':
  Metadata:
    encoder         : Lavf58.25.100
    Stream #0:0: Video: mpeg2video (Main), yuv420p(tv, progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 59.94 fps, 59.94 tbr, 90k tbn, 59.94 tbc
Stream mapping:
  Stream #0:1 -> #0:0 (copy)
Press [q] to stop, [?] for help
[mpeg @ 0000024ffd47d500] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
frame=10780 fps=0.0 q=-1.0 Lsize=   88314kB time=00:02:59.98 bitrate=4019.5kbits/s speed= 379x    
video:87826kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.556108%

real    0m1.546s
user    0m0.000s
sys     0m0.000s