Make videos with double audio
Project description
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>
#EXTM3U
is 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-cache
folder, - Extract audio to
audio
folder and select extension based onffprobe
(fromffmpeg
) output,
For example, from the
Stream #0:0: Audio: aac (LC), 48000 Hz, stereo, fltp, 94 kb/s
line will be takenaac
. - Download videos to
-
For each playlist from
video-playlists
download videos tovideo/
folder. -
Correlate audio and video file names (for example,
1x1.aac
will be added to1x1.mp4
). -
Join audios and videos and save to
video-result
folder. -
If
--preserve-video
is not passed, move resulting videos tovideo
folder.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file dual-audio-1.1.tar.gz
.
File metadata
- Download URL: dual-audio-1.1.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ffdf4fd8721fc496e69b65ecc7ababbeb6bf9af3bca23441a49a7447c132c59c |
|
MD5 | f1b9f793286409345de89c8a5faecc87 |
|
BLAKE2b-256 | 81286916b8dcf3d88b9f334237cf289196743dc456442bc1375fb16dd1c8ec98 |
File details
Details for the file dual_audio-1.1-py3-none-any.whl
.
File metadata
- Download URL: dual_audio-1.1-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99ed691b26cbfe0a0405d6840d43f39ce0c6e72401963b02d16026204766bbff |
|
MD5 | 2495c49e263bbff79477995fa1210547 |
|
BLAKE2b-256 | e3ad9f746c26c12b1ff7becf9f54de7d7e35d54bfcb2ac4e75fe9a83550ee995 |