gpt4 book ai didi

android - 除了使用 FFMPEG 和 MP4Parser 之外,还有什么方法可以修剪视频吗?

转载 作者:太空狗 更新时间:2023-10-29 14:36:52 24 4
gpt4 key购买 nike

我已经使用 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 持续时间之间修剪视频。

最佳答案

你上面的例子是根据你给它的命令重新编码视频。如果您不需要重新编码视频,您可以使用 stream copy option ,它直接将输入流复制到输出流。请注意,您不能严格保证获得精确的开始行为,因为您可能没有在那个确切点需要的 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

关于android - 除了使用 FFMPEG 和 MP4Parser 之外,还有什么方法可以修剪视频吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53994256/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com