首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >分割音频和视频文件

分割音频和视频文件
EN

Stack Overflow用户
提问于 2020-08-14 12:58:16
回答 2查看 1.3K关注 0票数 0

我想要执行HLS分割,并在分离的文件中获得音频和视频的每个片段从.mp4视频与音频。不需要调整比特率,因为这会导致额外的延迟。

我试着用

ffmpeg -i videoInput.mp4 -c:v复制-c:a复制-hls_segment_type mpegts -map a:0 -map v:0 -hls_time 1 out.m3u8 audio.ts

它完美地生成视频文件,但只生成一个音频文件。

谢谢。

EN

回答 2

Stack Overflow用户

发布于 2022-10-09 20:32:44

从FFmpeg文档中我了解到:

代码语言:javascript
复制
       When there are two or more variant streams, the output filename
       pattern must contain the string "%v", this string specifies the
       position of variant stream index in the output media playlist
       filenames. The string "%v" may be present in the filename or in the
       last directory name containing the file. If the string is present
       in the directory name, then sub-directories are created after
       expanding the directory name pattern. This enables creation of
       variant streams in subdirectories.

“”“

对我来说:

代码语言:javascript
复制
ffmpeg -hide_banner  -t 5:00 -i "$IN" -c copy -map a:0 -map v:0  -hls_segment_type mpegts -hls_time 1 -f hls   -var_stream_map "a:0 v:0"    v_%v/file.m3u8

在v_0 & v_1中创建两个流。

票数 1
EN

Stack Overflow用户

发布于 2020-08-17 08:49:28

我不知道确切的解决方案,但作为一种解决办法,您可以先用以下方法提取音频:

代码语言:javascript
复制
ffmpeg -i video.mp4 -c:a copy -vn audio.aac 

然后分别对视频和音频文件进行分段。

音频:

代码语言:javascript
复制
 ffmpeg -i audio.aac -c:a copy -hls_segment_type mpegts -map a:0 -hls_time 1 out_aud.m3u8

视频:

代码语言:javascript
复制
ffmpeg -i video.mp4 -c:v copy -hls_segment_type mpegts -map v:0 -hls_time 1 out_vid.m3u8
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63413237

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档