简体   繁体   English

如何将 AUDIO 组与 VIDEO 流相结合并使用 ffmpeg 生成新的 .ts 文件?

[英]How do I combine AUDIO group with VIDEO stream and produce a new .ts file using ffmpeg?

Here is the input manifest:这是输入清单:

$ curl 'https://example.net/ipadlive/index_new.m3u8?sessionid=81893121496608402793&ipaddress=x.x.x.x&callsign=YYYY&hubid=51&zipcode='
#EXTM3U
#EXT-X-VERSION:4
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="group",NAME="eng",DEFAULT=YES,AUTOSELECT=YES,LANGUAGE="en",URI="https://example.net/ipadlive/06_new.m3u8?cdnHost=da148.cdn.iptv.example.net&sessionid=81893121496608402793&ipaddress=x.x.x.x&callsign=CHAN&hubid=51&zipcode=&countycode=null&fta=null&optimumid=null&devicename=&devicetype=0&osver=&res=&fps="
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="group",NAME="spa",DEFAULT=NO,AUTOSELECT=YES,LANGUAGE="en",URI="https://example.net/ipadlive/07_new.m3u8?cdnHost=da148.cdn.iptv.example.net&sessionid=81893121496608402793&ipaddress=x.x.x.x&callsign=CHAN&hubid=51&zipcode=&countycode=null&fta=null&optimumid=null&devicename=&devicetype=0&osver=&res=&fps="
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=479776,RESOLUTION=240x180,CODECS="avc1.42c00c,mp4a.40.2",AUDIO="group"
https://example.net/ipadlive/01_new.m3u8?cdnHost=da148.cdn.iptv.example.net&sessionid=81893121496608402793&ipaddress=x.x.x.x&callsign=CHAN&hubid=51&zipcode=&countycode=null&fta=null&optimumid=null&devicename=&devicetype=0&osver=&res=&fps=
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=780576,RESOLUTION=320x240,CODECS="avc1.42c00d,mp4a.40.2",AUDIO="group"
https://example.net/ipadlive/02_new.m3u8?cdnHost=da148.cdn.iptv.example.net&sessionid=81893121496608402793&ipaddress=x.x.x.x&callsign=CHAN&hubid=51&zipcode=&countycode=null&fta=null&optimumid=null&devicename=&devicetype=0&osver=&res=&fps=
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1079872,RESOLUTION=480x360,CODECS="avc1.42c01e,mp4a.40.2",AUDIO="group"
https://example.net/ipadlive/03_new.m3u8?cdnHost=da148.cdn.iptv.example.net&sessionid=81893121496608402793&ipaddress=x.x.x.x&callsign=CHAN&hubid=51&zipcode=&countycode=null&fta=null&optimumid=null&devicename=&devicetype=0&osver=&res=&fps=
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1682976,RESOLUTION=640x480,CODECS="avc1.42c01e,mp4a.40.2",AUDIO="group"
https://example.net/ipadlive/04_new.m3u8?cdnHost=da148.cdn.iptv.example.net&sessionid=81893121496608402793&ipaddress=x.x.x.x&callsign=CHAN&hubid=51&zipcode=&countycode=null&fta=null&optimumid=null&devicename=&devicetype=0&osver=&res=&fps=

I've never seen this before where the audio stream is a separate url than a video stream listed in the manifest.我以前从未见过音频流是一个单独的 url,而不是清单中列出的视频流。

Is there a way I can combine an audio stream and a specific video stream to produce a new stream that has both audio and video in it?有没有一种方法可以将音频流和特定的视频流结合起来,以生成一个包含音频和视频的新流?

I was doing something like this:我正在做这样的事情:

ffmpeg -i <manifest> -c copy test.m3u8 and I don't get any audio. ffmpeg -i <manifest> -c copy test.m3u8我没有得到任何音频。

I've tried changing <manifest> to an individual video stream, but then no audio.我尝试将<manifest>更改为单个视频流,但没有音频。 If I change it to an AUDIO stream I get no video.如果我将其更改为 AUDIO 流,则没有视频。

I recently had the problem of combining an audio .ts file with its accompanying video .ts file.我最近遇到了将音频.ts 文件与其随附的视频.ts 文件结合起来的问题。 I was able to solve it using the following method for Windows users.对于 Windows 用户,我能够使用以下方法解决它。 [see - Video resource ] [见 - 视频资源]

1) You will need to download the ffmpeg library that will allow Windows to combine both files together. 1) 您需要下载ffmpeg 库,该将允许 Windows 将两个文件组合在一起。 In my case I was running Windows 8 (32 bit OS) and chose a static build:就我而言,我运行的是 Windows 8(32 位操作系统)并选择了静态构建: 我的操作系统下载要求

2) I then opened notepad and wrote the following code once ffmpeg was installed: ffmpeg -i VIDEO.ts -i AUDIO.ts -c:v copy -c:a copy OUTPUT.mp4 2)然后我打开记事本并在安装ffmpeg -i VIDEO.ts -i AUDIO.ts -c:v copy -c:a copy OUTPUT.mp4编写以下代码: ffmpeg -i VIDEO.ts -i AUDIO.ts -c:v copy -c:a copy OUTPUT.mp4

I saved the notepad file as "joiner.bat"我将记事本文件保存为“joiner.bat”

NB: this bat file must present in the same folder as your separate audio and video ts files in order to combine them!!!注意:此 bat 文件必须与您单独的音频和视频 ts 文件位于同一文件夹中才能将它们组合在一起!!!

3) Once the bat file is in the same folder as your audio and video ts files you can double click on the joiner.bat file to combine the audio and video ts files into a single mp4 (OUTPUT.mp4) file. 3) bat 文件与您的音频和视频 ts 文件位于同一文件夹中后,您可以双击 joiner.bat 文件将音频和视频 ts 文件合并为一个mp4 (OUTPUT.mp4) 文件。

I hope this helps the more novice types among us.我希望这可以帮助我们中更多的新手类型。 Yes I'm still a n00b after many years - don't worry!是的,多年后我仍然是 n00b - 别担心! ;) ;)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 FFmpeg - 从传输流文件 (.ts) 中提取视频和音频 - FFmpeg - Extracting video and audio from transport stream file (.ts) 如何将2个视频文件和音频文件与FFMPEG合并? - How to combine 2 video files and audio file with FFMPEG? 如何使用ffmpeg CLI拉伸音频流的开头,使用静音来匹配视频的开头? - How do I use the ffmpeg CLI to stretch the beginning of an audio stream, using silence, to match the start of the video? 如何使用 ffmpeg 组合 2 个作品音频文件? - How to combine 2 opus audio file using ffmpeg? ffmpeg 如何将文本/数据文件附加和提取到音频或视频 stream? - ffmpeg how to attach & extract text/data file to audio or video stream? 如何将.MP4视频与.WAV音频结合使用命令行参数中的ffmpeg创建新的.MP4视频? - How to combine a .MP4 video with a .WAV audio to create a new .MP4 video using ffmpeg from command line arguments? 如何使用 ffmpeg 将所有音频流(在视频文件中)合并到一个音频通道中? - How do I use ffmpeg to merge all audio streams (in a video file) into one audio channel? 如何在包含两个或多个音轨的视频文件中使用 ffmpeg 更改音频语言 - How do I change audio language using ffmpeg in video files contaning two or more audio tracks ffmpeg 从.ts 文件中仅提取 1 个音频 stream 的一部分 - ffmpeg extracts only part of 1 audio stream from .ts file 如何使用 ffmpeg 将新音频(不混合)添加到视频中? - How to add a new audio (not mixing) into a video using ffmpeg?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM