Dual-audio video maker
You can pass 2 playlists (or 2 lists with playlists), first for extracting audio (audio-playlists), second for resulting video (video-playlists), and get video with both audio tracks. For the first playlists it is better to use low quality video.
Dependencies
You need installed in system ffmpeg (work with media), wget (download) and grep utilities.
Install
pip install dual-audio
Usage example
Extract audios from video files from audio-playlist.m3u and add to related videos from video-playlist.m3u (for example, 1x1.aac will be added to 1x1.mp4).
dual-audio --out-dir . -a audio-playlist.m3u -v video-playlist.m3u
Number of entries in both audio and video playlists should be equal.
After downloading and converting, you may also want to specify a language for each audio track. Create a file with filenames to do this mapping, e.g. list.txt (or use finished.txt), then if the first audio track is russian and the second is english, run:
dual-audio \
--fix-audio-lang \
--fix-audio-lang-list list.txt \
--first-audio-lang rus \
--second-audio-lang eng
First track from video playlist, second from audio playlist.
CLI arguments
| Argument | Action |
|---|---|
-d, --out-dir |
Directory where place audio and video folders |
-a, --audio-playlists |
Path(s) to playlist(s) with videos from which extract audio |
-v, --video-playlists |
Path(s) to playlist(s) with videos to add a second audio |
--args |
Pass shell arguments via file |
--preserve-video |
Preserving original videos from video-playlists |
-h, --help |
Show help message and exit |
--fix-audio-lang |
Fix audio tracks language metadata 1 |
--fix-audio-lang-list |
File with list of filenames to fix language |
--first-audio-lang |
Language in first audio track (from video file) 2 |
--second-audio-lang |
Language in second audio track (from extracted audio) |
1 If specified, downloading and converting will not be performed.
2 Language is 3-letter identifier like "eng" or "rus".
Shortened M3U playlist syntax
You can write playlists manually by this template:
#EXTM3U
#EXTINF: <duration>,<title>
#EXTVLCOPT:
<link>
#EXTM3Uis the required header for the file,- duration can be zero,
- the title must not contain commas,
- the link should be on a separate line,
- other lines and directives are ignored and can be omitted.
For example:
#EXTM3U
#EXTINF: 0,Your show - episode 1
http://example.com/1x1.mp4
#EXTINF: 0,Your show - episode 2
http://example.com/1x2.mp4
These videos will be saved as Your show - episode 1.mp4 and Your show - episode 2.mp4.
How it works
-
Parse playlists.
-
Download
audio-playlists. For each playlist:- Download videos to
video-cachefolder, - Extract audio to
audiofolder and select extension based onffprobe(fromffmpeg) output,
For example, from the
Stream #0:0: Audio: aac (LC), 48000 Hz, stereo, fltp, 94 kb/sline will be takenaac. - Download videos to
-
For each playlist from
video-playlistsdownload videos tovideo/folder. -
Correlate audio and video file names (for example,
1x1.aacwill be added to1x1.mp4). -
Join audios and videos and save to
video-resultfolder. -
If
--preserve-videois not passed, move resulting videos tovideofolder.
Metadata
Release files for dual-audio 1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dual-audio-1.1.tar.gz | 8.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dual_audio-1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.1 kB
Release files / dual-audio-1.1.tar.gz
| Download URL | dual-audio-1.1.tar.gz |
|---|---|
| Size | 8.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ffdf4fd8721fc496e69b65ecc7ababbeb6bf9af3bca23441a49a7447c132c59c
|
|
BLAKE2b-256 checksum How to use checksums |
81286916b8dcf3d88b9f334237cf289196743dc456442bc1375fb16dd1c8ec98
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
|
Release files / dual_audio-1.1-py3-none-any.whl
| Download URL | dual_audio-1.1-py3-none-any.whl |
|---|---|
| Size | 8.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
99ed691b26cbfe0a0405d6840d43f39ce0c6e72401963b02d16026204766bbff
|
|
BLAKE2b-256 checksum How to use checksums |
e3ad9f746c26c12b1ff7becf9f54de7d7e35d54bfcb2ac4e75fe9a83550ee995
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
|