ffmpeg download and install multi-segment ts video m3u8 download

How to download multi-segment ts video m3u8  ffmpeg

ffmpeg tutorial

download

Windows download method

step1. Official website download address

Click here to enter the download address

step2. Select Windows builds by BtbN in Windows EXE files

This will jump to the github page.

step3. Select the corresponding linux platform or windows platform to download

Install

step1. Store the downloaded decompressed file in a relatively fixed directory

The following is my path.
Then you will find that there is a folder called bin in the decompressed file. This folder is where our executable files are stored. Add this bin folder to the system environment variable later.

D:\SW_Portable\ffmpeg-set-as_env

step2. Add the bin file to the Windows environment variable

Right click on My Computer -> Properties -> Advanced System Settings -> Environment Variables -> System Variables -> Click Path -> Edit...

Add the directory set by step1 to it

D:\SW_Portable\ffmpeg-set-as-env\bin

other installation methods

installation method

execute script

  • command line execution
# 下载网页视频流m3u8的方法:
# ffmpeg -i 网页 输出文件
ffmpeg -i http://xxx/index.m3u8 output.mp4

# 带其他参数的版本
# ffmpeg 命令
# -i 跟输入网页
# -acodec 跟音频解码 -codec:a -c:a
# -vcodec 跟视频解码 -codec:v -c:v
# -absf  音视频比特率 推荐使用 -b:a -b:v -bsf:a -bsf:v (binary steam fiter)
ffmpeg -i http://xxx/index.m3u8 -acodec copy -vcodec copy -absf aac_adtstoasc D:\output.mp4
  • Write windows DOS bat script

The script download.batcontent is as follows:

rem windows dos脚本
@echo off

echo "start"
echo "%1"

if "%1" == "" (
	goto end
)

set TimeIndex=%date:~0,4%%date:~5,2%%date:~8,2%%time:~0,2%%time:~3,2%%time:~6,2%
set videoHead=video
set videoEnd=.mp4
set output=%videoHead%%TimeIndex%%videoEnd%

ffmpeg -i %1 -acodec copy -vcodec copy -absf aac_adtstoasc "%output%"

:end
@echo "end"

command line execution

download.bat http://xxx/index.m3u8

write python script

import os
cmd = "download.bat" + " " + "http://xxx/index.m3u8"
os.system(cmd)

ffmpeg appendix

other references

document

Click to view  ffmpeg documentation

Source code download method
Click here to enter the download address

git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg

There are already multiple ts merged into mp4 locally

Windows
Windows, note that *.ts must be stored in an orderly manner for video streams, otherwise an exception will occur.

# windows下, 注意 *.ts必须为视频流有序存放,否则会出现异常。
# /b 合并指令
copy /b *.ts output.mp4

Original  ffmpeg download and install multi-segment ts video m3u8 download

★The business card at the end of the article can receive audio and video development learning materials for free, including (FFmpeg, webRTC, rtmp, hls, rtsp, ffplay, srs) and audio and video learning roadmaps, etc.

see below!

 

Guess you like

Origin blog.csdn.net/yinshipin007/article/details/131641952