分类 Technology 中的文章

M3U8 to MP4 Tutorial: Download and Convert M3U8 Videos Using Python or Static HTML

Sometimes you may want to download an M3U8 (HLS) video stream and convert it into an MP4 file for offline viewing or local storage, without relying on complex server-side solutions or paid software.

In this article, I will introduce two practical and commonly used methods to convert M3U8 to MP4:

  1. Using Python with the downloadm3u8 package
  2. Using static HTML with browser-side FFmpeg (FFmpeg.wasm)

Method 1: Convert M3U8 to MP4 Using Python downloadm3u8

This method is suitable for local machines or servers, requires installing dependencies, and is very stable.
It is recommended for large video files or batch downloads.

1. Install Dependencies

First, install ffmpeg (used for video merging) and the downloadm3u8 Python package:

apt install ffmpeg -y
pip install downloadm3u8

2. View Help Information

After installation, check the available options:

downloadm3u8 -h

Example output:

usage: m3u8downloader [-h] [--user-agent USER_AGENT] [--origin ORIGIN]
                      [--version] [--debug] --output OUTPUT
                      [--tempdir TEMPDIR] [--keep]
                      [--concurrency N]
                      URL

3. Download Example

Assume your M3U8 URL is: bobobk test m3u8

……

阅读全文

Using Matplotlib's fill_between for Area Filling in Python

When plotting with matplotlib in Python, sometimes to enhance the aesthetics of the graph, it’s necessary to fill with color above or below the plot. The ‘fill_between’ function is used for this, where the ‘y2’ parameter determines the second line, indicating whether to fill upwards or downwards.……

阅读全文

How to Improve Website Indexing Speed with IndexNow

In current SEO practices, rapid indexing of pages by search engines is a key concern for webmasters. Traditional search engines rely on crawlers to periodically fetch website content, resulting in low indexing efficiency. IndexNow is a proactive submission protocol that allows websites to notify search engines of content updates in real-time, significantly improving indexing speed. This article will explain how to use IndexNow for efficient indexing.……

阅读全文

Automatically Publishing Articles to WordPress Using a Python Script: A Complete Workflow Analysis

When building content sites or AI content distribution projects, how can you efficiently batch publish generated content to WordPress? This article will share how I used a Python script to build an automated content publishing process that does not rely on the WordPress backend, does not require XML import, and directly connects to the database for maximum efficiency.……

阅读全文

Python: Creating Beautiful Lollipop Charts

The lollipop chart, as a variant of bar charts and dot plots, is increasingly popular in scientific research due to its simplicity and clarity. This chart cleverly combines the advantages of bar charts and scatter plots, offering a visually more attractive way to represent data.……

阅读全文

Downloading m3u8 Streaming Media Using Python and Embedding into AMP Webpages

In the era of short videos and live streaming, video formats are often no longer traditional ones like mp4 or mkv, but streaming formats such as m3u8. If you want to download your favorite videos, special handling is needed. This article provides a detailed example of how to download m3u8 streaming data using Python and embed it into an AMP webpage for playback. Let’s dive into the full process.……

阅读全文

Managing Long-Running Tasks on Unix-like Systems

Due to daily work all using Linux systems, generally for commands known to run for a long time, nohup, screen, or tmux are used to run the command. However, sometimes after starting a command, you suddenly realize it runs very long. Is there a way to continue working in the current shell and keep the command running after logout until the task finishes?……

阅读全文