使用ffmpeg按大小分割视频文件 [英] Using ffmpeg to split video files by size

查看:567
本文介绍了使用ffmpeg按大小分割视频文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用ffmpeg编写一个批处理文件,以自动执行从4gb块(大多数单反相机和GoPro的标准)录制的工作中的素材的冗余日常任务,并将剪辑分割成2gb文件用于流媒体。这个想法是让脚本检查外部驱动器FOOTAGE的文件夹@import和2gb之后的分割文件(由于最大大小为4gb,这将减轻需要多个拆分)。



我还要修改分割文件的文件名,所以FILE1是4gb,它分别分别是每个2GB的FILE1_1和FILE1_2。我尝试的一切都将原始文件复制到两个新的完全相同的文件中 - 没有分割或任何东西。



在做了一些谷歌搜索并在这里阅读了一些答案后,我发现这个帖子,但它是基于持续时间,而不是大小(录制视频素材在不同的质量水平使这无意义):分割成相同的部分,并使用ffmpeg转换许多mp4视频



有人可以帮助我这个吗我没有遇到任何可用的解决方案,利用我所理解的方法,使用-fs limit_size,我真的想了解这是如何工作的。



更新:还发现这一点,但是在四年内还没有更新,我没有看到有关拆分的任何内容将有助于:



https://github.com/kcm1700/VideoSplitter/blob/master/

解决方案

您可以使用 mp4box

  mp4box -splits 2000000 filename.mp4 

其中 splits 参数以千字节为单位。由于存在关键帧,分段将不会完全为2GB。


I'm trying to write a batch file using ffmpeg to automate the redundant daily task of taking footage from work that's recorded in 4gb blocks (which is standard in most DSLR cameras & GoPro's), and split the clips into 2gb files for streaming purposes. The idea is to have the script check external drive FOOTAGE's folder @import and split files after 2gb (since the max size is 4gb, this will alleviate the need for more than one split).

I'm also trying to amend the filenames of the split files, so FILE1 is 4gb, it splits into FILE1_1 and FILE1_2 which are 2gb each, respectively. Everything I've tried has just copied the original file into two new, identical files - no split or anything.

After doing some Googling and reading some of the answers here, I found this post, but it's based on duration, not size (recording video footage at varying levels of quality makes this pointless): Split into equal parts and convert many mp4 videos using ffmpeg

Can someone help me with this? I haven't come across any usable solutions utilizing what I understand to be the method, using -fs limit_size, and I really want to understand how this works.

UPDATE: Also found this, but it hasn't been updated in four years and I don't see anything in there regarding splitting that will prove helpful:

https://github.com/kcm1700/VideoSplitter/blob/master/

解决方案

You can do this in one command using mp4box.

mp4box -splits 2000000 filename.mp4

where splits argument takes value in kilobytes. Due to presence of keyframes, segments won't be exactly 2GB.

这篇关于使用ffmpeg按大小分割视频文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆