What Is the Default Video Download Format in ReClip?
ReClip defaults to downloading the highest‑quality video and audio streams merged into an MP4 container when no specific format is requested.
The open‑source tool ReClip (available at averygan/reclip) automates media downloads through a REST API. When users submit a download request without specifying a format parameter, the application automatically applies its default video download format to ensure maximum quality and compatibility.
How ReClip Determines the Default Video Format
ReClip intelligently selects media streams using yt‑dlp conventions when the client omits format details.
The Default Format Logic in app.py
Inside app.py, the start_download function handles incoming API requests. When the format field is missing from the JSON payload, the server implicitly treats the request as a video download, defaulting the internal format identifier to "video". This logic appears around line 70 of the main application file.
The actual command construction occurs in the run_download function (lines 38‑44). If no specific format_id is provided, ReClip builds the yt‑dlp command with the following arguments:
-f bestvideo+bestaudio/best --merge-output-format mp4
This instructs yt‑dlp to:
- Select the best available video stream
- Select the best available audio stream
- Merge both streams into an MP4 container using FFmpeg
Technical Implementation Details
The default behavior leverages yt‑dlp's format selection syntax to guarantee the highest possible quality. The bestvideo+bestaudio/best fallback ensures that if separate video and audio streams are unavailable, yt‑dlp falls back to a combined best stream.
The --merge-output-format mp4 flag forces the output container to MP4 regardless of the source codecs, ensuring broad device compatibility for the downloaded file.
Using the ReClip API with Default Settings
To use the default video download format in ReClip, simply omit the format and format_id fields from your API request:
curl -X POST https://<host>/api/download \
-H "Content-Type: application/json" \
-d '{"url":"https://www.youtube.com/watch?v=example"}'
The server responds with a job_id. Upon completion, the downloaded file will be an MP4 containing the highest‑quality video and audio streams available for that URL.
Overriding the Default
To bypass the default and request a specific quality (for example, format ID 137), include the optional parameters:
curl -X POST https://<host>/api/download \
-H "Content-Type: application/json" \
-d '{
"url":"https://www.youtube.com/watch?v=example",
"format":"video",
"format_id":"137"
}'
When format_id is present, ReClip skips the bestvideo+bestaudio logic and requests that specific stream directly.
Summary
- ReClip defaults to
bestvideo+bestaudiomerged into an MP4 file when downloading video content without explicit format instructions. - The default logic resides in
app.py, specifically within thestart_download(line 70) andrun_download(lines 38‑44) functions. - The implementation utilizes yt‑dlp with the arguments
-f bestvideo+bestaudio/best --merge-output-format mp4. - Users can override the default by supplying a specific
format_idin the API request body.
Frequently Asked Questions
What container format does ReClip use by default?
ReClip outputs MP4 as the default container format. The --merge-output-format mp4 argument in the yt‑dlp command ensures that even when source streams use different codecs, the final merged file is packaged as a universally compatible MP4.
Can I override the default video download format in ReClip?
Yes. You can override the default by including a format_id parameter in your API request. When provided, ReClip passes this specific ID to yt‑dlp instead of using the bestvideo+bestaudio selector, allowing you to download exact resolutions or codecs as needed.
What happens if the best video and audio streams are incompatible?
The /best fallback in the format selector (-f bestvideo+bestaudio/best) ensures that if yt‑dlp cannot merge the separate streams due to codec incompatibility, it automatically falls back to selecting the single best combined stream available, maintaining download reliability.
Where in the codebase is the default format configured?
The default format is configured in app.py. The logic that defaults requests to video format appears in the start_download function around line 70, while the command construction using bestvideo+bestaudio and the MP4 merge flag occurs in the run_download function between lines 38 and 44.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →