

Setup
- Clone/Download:
- Download this repository or run
git clone https://github.com/MK2112/any_to_any.py.git
- Alternatively, download an executable for Windows or Linux
- Python Version:
- Ensure you have Python
3.10.x or higher installed
- Install Dependencies:
- Open a terminal from inside the repository and run:
pip install -r requirements.txt
- Running the Script:
Use Any_to_Any.py in three different ways (click for details):
Web Interface
- Start the web interface:
python any_to_any.py -w
- Access the web view at
http://localhost:5000 via your browser
- Stop the web interface by pressing
CTRL+C in the terminal
Graphical User Interface (GUI)
The GUI is intended for users who want as much ease of use as possible without requiring a browser.
- Drag and drop files or folders for instant batch conversion
- Select output format, directory, and advanced options
- Merge, concatenate, or extract as easily as with the CLI/web
- Multi-language support
You can access the GUI via the pre-packaged binaries, or run it directly from source.
Install GUI-related additional dependencies:
pip install -r requirements_gui.txt
Launch the GUI:
python gui/qt_app.py
If you want to build a standalone executable for Windows/Linux/macOS, ideally install and use UPX:
python gui/build.py
Runtime Requirements For Binaries
The standalone binaries do not bundle ffmpeg and instead are configured to use a system-installed ffmpeg.
On Windows, this installation of ffmpeg additionally has to be made available in the PATH.
Linux (Debian/Ubuntu):
sudo apt-get install ffmpeg
Windows (tested for ffmpeg 8.0.1 on Windows 10):
- Download a Windows build from ffmpeg.org/download.html (for example from
gyan.dev)
- Specifically download
ffmpeg-release-full.7z for broadest codec coverage
- Extract the archive to a permanent location, e.g.
C:\ffmpeg
- Add
C:\ffmpeg\bin to the system Path:
- Open Start, search for
Environment Variables, open Edit the system environment variables
- Click
Environment Variables...
- Under
System variables, select Path -> Edit -> New
- Add
C:\ffmpeg\bin and confirm with OK

Download (Windows/Linux)
Command Line Interface
This is the most feature-rich interface for any_to_any.py.
You can structure a command in three fundamental ways:
Single File Processing
Convert a WEBP file to PNG:
python any_to_any.py -i /path/to/file.webp -f png
Convert MP4 to MP3, delete the MP4 source file afterwards:
python any_to_any.py -i /path/to/file.mp4 -f mp3 -d
Convert MP3 to M4A, set conversion quality to high, delete the MP3 source file afterwards:
python any_to_any.py -i /path/to/file.mp3 -f m4a -q high -d
Convert MP4 to HLS streams:
python any_to_any.py -i /path/to/file.mp4 -f hls
The option for hls creates a directory with distinct folders for stream fragments of resolutions 426x240, 640x360, 842x480, 1280x720, and 1920x1080.
Resize an MP4 to 1280x720, keeping its file format:
python any_to_any.py -i /path/to/file.mp4 -res 1280x720
Resize while converting to a different format, e.g. MP4 to MKV at 1080p:
python any_to_any.py -i /path/to/file.mp4 -f mkv -res 1080p
Resolutions can be given as WxH (e.g. 1920x1080) or as an alias such as 4k, 1440p, 1080p, 720p, 480p, 360p or 240p. Not every file format supports every resolution — if the requested resolution is not enabled by the target format (or, if no -f/--format is given, by the input file’s own format), the available resolutions are listed and the script exits.
If you feel like it, you can even convert an MP4 file to a PDF, that PDF to a GIF and the GIF back to MP4:
# Create the PDF containing the movie's frames [Movie -> Document]
python any_to_any.py -i /path/to/file.mp4 -f pdf
# Create the GIF from your PDF [Document -> Image]
python any_to_any.py -i /path/to/file.pdf -f gif
# Create the MP4 from your GIF again [Image -> Movie]
python any_to_any.py -i /path/to/file.gif -f mp4
You may also convert the images contained in a DOCX file to an MP4 video:
python any_to_any.py -i /path/to/file.docx -f mp4
Split a PDF into multiple files, either by page count or page ranges, e.g. 1-2,3-5 or 10 or 1-3,2-6,8-end or 1-5,rest:
python any_to_any.py -i /path/to/file.pdf -s 1-3,2-6,8-end
Directory Processing
Directory Processing is useful when you want to work with multiple files in a directory
Convert all WEBP files in a directory to PNG:
python any_to_any.py -i /path/to/webp-folder -f png
Convert all WEBP files in a directory to PNG and JPEG:
python any_to_any.py -i /path/to/webp-folder -f png,jpeg
Convert all MP4 files to MP3, save to a different directory, set conversion quality to high, delete MP4 source files afterwards:
python any_to_any.py -i /path/to/mp4-folder -o /path/to/save/folder -f mp3 -q high -d
Convert all MP3 files from any subdirectory recursively to M4A, delete MP3 source files afterwards:
python any_to_any.py -i /path/to/mp3-top-folder -f m4a -d -r
Merge MP4 files with respective, equally named MP3 files in the same directory, save to a different directory, delete source files afterwards:
python any_to_any.py -i /path/to/folder -o /path/to/save/folder -m -d
Burn an equally named SRT subtitle file into the converted movies (e.g. file.mp4 + file.srt):
python any_to_any.py -i /path/to/mp4-folder -o /path/to/save/folder -f mp4 --burn-subs
Trim audio/video to a time range (keeps the input format when -f is omitted):
python any_to_any.py -i /path/to/media-folder -o /path/to/save/folder --trim 00:00:30-00:01:45
Split audio/video at one or more time points:
python any_to_any.py -i /path/to/media-folder -o /path/to/save/folder --split-at 60,120
Concatenate MP4 files, save to a different directory, delete source files afterwards:
python any_to_any.py -i /path/to/mp4-folder -o /path/to/save/folder -c -d
Dropzone Mode
You can turn a folder into a “dropzone”.
Files will be converted when they are added to that folder and the result will be saved in the output directory.
The dropped, original file will be deleted after conversion.
To set up a dropzone, specify:
- The input directory with
-i/--input,
- The output directory with
-o/--output,
- The desired format to convert to with
-f/--format,
- The
-z/--dropzone parameter.
This sets up a dropzone to convert files to MP3, saving them in the output directory:
python any_to_any.py -i /path/to/dropzone -o /path/to/save_folder -f mp3 -z
The script will run continuously, monitoring the input directory for new files.
This runs continuously, halt it by pressing CTRL+C.
Multi Directory/File Processing
You may also process multiple individual files or multiple directories at once.
Note that only one output directory can be specified.
An output directory is required when multiple inputs are given.
For a single input, you can omit -o/--output and the output is written next to that input.
python any_to_any.py -i -1 /path/to/file1.mp4 -2 /path/to/mp4-folder -o /path/to/output-folder -f mp3
Merging across directories works when adding -a/--across to the -m/--merge parameter:
python any_to_any.py -i -1 /path/to/folder1 -2 /path/to/folder2 -o /path/to/output-folder -m -a
Concatenating across directories works when adding -a/--across to the -c/--concat parameter:
python any_to_any.py -i -1 /path/to/folder1 -2 /path/to/folder2 -o /path/to/output-folder -c -a
Omitting the -a/--across parameter will execute merges or concatenations seperately, per each input directory.
Parallel Processing
- Per-file conversions (e.g., audio-to-audio, movie-to-movie, gif-to-video) are processed in parallel.
- Override default (
1 worker) by setting --workers N where N can be any integer from 1 to cpu_count - 1.
Directory with many audio files:
python any_to_any.py -i /path/to/folder -f mp3 --workers 4
Explicit multiple files:
python any_to_any.py -i /path/to/a.wav /path/to/b.flac /path/to/c.ogg -f mp3 --workers 4 -o /path/to/output_dir
Recursive scan (include subdirectories):
python any_to_any.py -i /path/to/input_dir -f mp3 --workers 4 --recursive
Parameters
| Command Argument |
Meaning |
-h or --help |
List all available parameters, their description and default values, then exit. |
--formats |
List every target format with its availability on this system and the reason when unavailable, then exit. |
-i or --input |
Path to file itself or directory containing files to be converted. If not provided, the directory from where the script is called will be used. |
-f or --format |
Desired output file format, either mp2, mp3, flac, wav, aac, aiff, ogg, oga, m4a, ac3, dts, weba, wma, mka, wv, caf, tta, m4b, eac3, spx, au, opus, m3u8, w64, mlp, adts, sbc, thd, g722, ra, voc, dfpwm, apm, ircam, jpeg (and jpg), png, gif, bmp, pdf, docx, pptx, srt, webp, heic, heif, avif, tiff, tga, eps, ps, ico, jpeg2000, im, pcx, ppm, mp4, webm, mov, mkv, avi, wmv, flv, m2ts, 3gp, 3g2, mjpeg, asf, vob, ts, raw, mpg, mxf, drc, swf, f4v, m4v, mts, m2v, yuv, wtv, apng, ivf, movie codecs like h263p, h264, h265, xvid, mpeg1, mpeg2, mpeg4, av1, avc, theora, vp8, vp9, hevc, prores, huffyuv, ffv1, ffvhuff, v210, v410, v308, v408, zlib, qtrle, snow, svq1, utvideo, cinepak, msmpeg4, h264_nvenc, vpx, h264_rgb, mpeg2video, prores_ks, vc2, flv1, or protocols like hls and dash. Target formats can also be written in concatenated form like so jpeg,png,bmp to convert to all three supported formats jpeg, png and bmp at once, if possible |
-o or --output |
Directory to save converted files into. Writing to the input file path, if none provided. |
-q or --quality |
Set output file quality, either low, medium, or high; default is same as input. |
-m or --merge |
Merge movie file with equally named audio file to become its audio track. |
-c or --concat |
Concatenate input files of the same type (images, audio, video) into one output file (e.g. concatenated_video.mp4 for movie files, concatenated_audio.mp3 for audio files). |
-s or --split |
Split a PDF into multiple files, either by page count or page ranges, e.g. 1-2,3-5 or 10 or 1-3,2-6,8-end or 1-5,rest. |
-a or --across |
Merge/Concatenate across directories when multiple directories are provided. |
-w or --web |
Ignores all other arguments, starts browser + a web server at http://localhost:5000. |
-d or --delete |
Delete input files after conversion. |
-r or --recursive |
Recursively process all input files in subdirectories from the input directory. Outputs by default will be placed in their respective subdirectory, unless different output path provided. |
-z or --dropzone |
While running, a specified directory will be monitored for new files. When a file is added, it will be converted to the specified format, saved in the output directory and deleted from the input directory. |
-fps or--framerate |
Set the framerate (fps) when converting to a movie format or codec; default maintains input fps. |
-res or--resolution |
Resize movies to a specific resolution, e.g. 1920x1080 or 720p. Works alone (keeping the input file format) or combined with -f/--format, subject to what the target format allows. If the resolution is not supported by the effective target format, the available resolutions are listed and the script exits. |
--burn-subs |
Burn an equally named .srt subtitle file next to each movie into the converted movie (e.g. file.mp4 + file.srt). |
--trim |
Trim audio/video to a time range, e.g. 00:00:30-00:01:45. Times accept seconds, MM:SS, or HH:MM:SS(.ms); open ends like 30- are supported. |
--split-at |
Split audio/video at time points, e.g. 60,120. Writes numbered _part_N outputs; accepts the same time formats as --trim. |
--workers |
Set the maximum number of parallel worker threads for per-file conversions (1 to cpu_count - 1 are supported). Defaults to 1. |
--preserve-meta |
Preserve metadata (ID3 tags for audio, EXIF for images, properties for documents) in output files and save metadata as JSON for archival purposes. |
--add-tag |
Add custom tags to files during conversion (format: key:value key2:value2). Tags are stored in metadata JSON files. |
--strip-meta |
Remove all metadata from output files for privacy, specifically ID3 tags, EXIF data, and document properties such as PDF title/author or Office document properties. |
-l or --language |
Set the CLI language, currently supported: zh_CN (Mandarin, Simplified), ja_JP (Japanese), fr_FR (French), es_ES (Spanish), es_MX (Spanish, Mexican), it_IT (Italian), de_DE (German), pt_BR (Portuguese, Brazilian), uk_UA (Ukrainian), ko_KR (Korean), en_US (American English), pl_PL (Polish), hi_IN (Hindi), ru_RU (Russian), ar_SA (Arabic), id_ID (Indonesian), tr_TR (Turkish), vi_VN (Vietnamese), th_TH (Thai), nl_NL (Dutch), sv_SE (Swedish), da_DK (Danish), fi_FI (Finnish), no_NO (Norwegian), is_IS (Icelandic), he_IL (Hebrew), cs_CZ (Czech), ro_RO (Romanian), ms_MY (Malay), bg_BG (Bulgarian), hu_HU (Hungarian), el_GR (Greek), sk_SK (Slovak), zh_TW (Mandarin, Traditional), fa_IR (Persian, Farsi), ur_PK (Urdu), sw_TZ and sw_KE (Swahili), pa_IN and pa_PK (Punjabi), tl_PH (Tagalog), my_MM (Burmese), ta_IN (Tamil), te_IN (Telugu), mr_IN (Marathi), ca_ES (Catalan), hr_HR (Croatian), zh_HK (Cantonese), sr_RS (Serbian), bs_BA (Bosnian). Fallback is en_US. |
Using Docker Compose (Quickstart)
- Navigate to the project directory:
cd any_to_any.py
- Create the shared folders that will hold uploads, conversions and CLI output:
mkdir -p uploads converted out (they are bind-mounted into the container,
which runs as the non-root user with UID 1000, if your user has a
different UID, run chown -R 1000:1000 uploads converted out first)
- Start web interface:
docker-compose up
- Visit:
http://localhost:5000
The web server runs under gunicorn and binds to 0.0.0.0 inside the
container (configurable via the Any2Any_HOST / Any2Any_PORT environment
variables). The container reports its health on port 5000, and uploads/
conversions are cleaned up automatically.
To run subsequent times without rebuilding:
docker-compose up
Run python any_to_any.py --formats to see which targets are available on this
system, including the reason when a format is unavailable.
Audio: MP2, MP3, FLAC, AAC, AC3, DTS, OGG, OGA, WMA, WAV, M4A, AIFF, WEBA, MKA, WV, CAF, TTA, M4B, EAC3, SPX, AU, OPUS, M3U8, W64, MLP, ADTS, SBC, THD, G722, RA, VOC, DFPWM, APM, IRCAM
Image: JPEG, PNG, GIF, BMP, WEBP, TIFF, TGA, EPS, PS, ICO, EPS, JPEG2000, IM, PCX, PPM, HEIF, HEIC, AVIF
Document: PDF, DOCX, PPTX, SRT
Video: MP4, WEBM, MOV, MKV, AVI, WMV, FLV, MJPEG, M2TS, 3GP, 3G2, ASF, VOB, TS, RAW, MPG, MXF, DRC, SWF, F4V, M4V, MTS, M2V, YUV, WTV, APNG, IVF
Video Codec: AV1, AVC, VP8, VP9, H263P, H264, H265, XVID, MPEG2, MPEG4, THEORA, MPEG1, HEVC, PRORES, HUFFYUV, FFV1, FFVHUFF, V210, V410, V308, V408, ZLIB, QTRLE, SNOW, SVQ1, UTVIDEO, CINEPAK, MSMPEG4, H264_NVENC, VPX; H264_RGB, MPEG2VIDEO, PRORES_KS, VC2, FLV1
Protocols: HLS, DASH
License
AGPLv3.
Disclaimer
This script is provided as-is, without any warranties or guarantees.
Users are responsible for ensuring compliance with applicable laws and regulations.
评论