Skip to content

Fix: Replace 7z with ffmpeg for playable MP4 parts#18

Open
BraveVahid wants to merge 1 commit into
nscl5:mainfrom
BraveVahid:ffmpeg-split
Open

Fix: Replace 7z with ffmpeg for playable MP4 parts#18
BraveVahid wants to merge 1 commit into
nscl5:mainfrom
BraveVahid:ffmpeg-split

Conversation

@BraveVahid
Copy link
Copy Markdown

Changes Made:

  • Replace 7-Zip with ffmpeg for file splitting
  • Each part is now an independent, playable MP4 file
  • Users no longer need special software to extract files
  • Fix "File exists" error when splitting large files
  • Each part is 5 minutes duration

Benefits:

  • No technical knowledge required for users
  • Each part plays directly on any device
  • No need for file joining or extraction
  • Better handling of Persian/Arabic filenames

Technical:

  • Uses ffmpeg segment muxer for splitting
  • Preserves original quality with stream copy
  • Fallback to split command if duration detection fails
  • 95MB limit for single files

@sagkhis
Copy link
Copy Markdown

sagkhis commented May 10, 2026

It's inconvenient to split long videos into shorter 5 minutes parts. Instead add this as an option and make it the default one without replacing the 7-zip method. Thank you for your consideration

@Diana-Cl
Copy link
Copy Markdown
Collaborator

● ●●● Your Changes:
  • Replace 7-Zip with ffmpeg for file splitting
  • Each part is now an independent, playable MP4 file
  • Users no longer need special software to extract files
  • Fix "File exists" error when splitting large files
  • Each part is 5 minutes duration

Benefits:

  • No technical knowledge required for users
  • Each part plays directly on any device
  • No need for file joining or extraction
  • Better handling of Persian/Arabic filenames

Technical:

  • Uses ffmpeg segment muxer for splitting
  • Preserves original quality with stream copy
  • Fallback to split command if duration detection fails
  • 95MB limit for single files


Hi @BraveVahid ,

First of all, thank you so much for taking the time to write this code and submit the Pull Request, Your core idea allowing users to download playable video parts without needing external extraction software is genuinely brilliant and heavily improves the UX for mobile users.

However, after reviewing the code, I decided not to merge this PR directly due to a few critical technical and UX reasons:

  1. Corrupted Fallback (The split -b issue):
    In your script, if ffprobe fails to get the duration, the code falls back to split -b 90m "$FILE". This is highly problematic for video files. You cannot split an .mp4 file blindly by byte size. Doing so cuts the file without preserving the moov atom (MP4 headers), rendering the resulting parts completely corrupted and unplayable.

  2. Muxing Inefficiency:
    Using a while loop to manually cut parts via ffmpeg -ss can be slow, might drop frames at the cutting points, and causes audio sync issues on longer videos.

  3. User Preference (Forced Chunking):
    As pointed out by dear @sagkhis in the comments, forcing every >95MB file to be cut into 5-minute pieces can be frustrating for those downloading movies or large archives (like APKs) who prefer standard .001 archive joining. But ...

How we resolved this:
Inspired entirely by your PR, I have rewritten the core logic in the latest commit. Instead of replacing 7z, I added a UI Dropdown (split_method) so users can choose between standard 7z Archive or Video Chunks.
Furthermore, for the video chunking, I implemented ffmpeg -f segment -segment_time 300 which splits the video natively, safely, and instantly without corrupting the headers or needing a fallback loop.

I am closing this PR, but I want to give you full credit for sparking this feature. Thank you again for your valuable contribution and for helping make this repository better 🩶🤚🏿

@Diana-Cl Diana-Cl added enhancement New feature or request good first issue Good for newcomers and removed good first issue Good for newcomers labels May 10, 2026
@BraveVahid
Copy link
Copy Markdown
Author

● ●●● Your Changes:

Hi @BraveVahid ,

First of all, thank you so much for taking the time to write this code and submit the Pull Request, Your core idea allowing users to download playable video parts without needing external extraction software is genuinely brilliant and heavily improves the UX for mobile users.

However, after reviewing the code, I decided not to merge this PR directly due to a few critical technical and UX reasons:

1. **Corrupted Fallback (The `split -b` issue):**
   In your script, if `ffprobe` fails to get the duration, the code falls back to `split -b 90m "$FILE"`. This is highly problematic for video files. You cannot split an `.mp4` file blindly by byte size. Doing so cuts the file without preserving the `moov atom` (MP4 headers), rendering the resulting parts completely corrupted and unplayable.

2. **Muxing Inefficiency:**
   Using a `while` loop to manually cut parts via `ffmpeg -ss` can be slow, might drop frames at the cutting points, and causes audio sync issues on longer videos.

3. **User Preference (Forced Chunking):**
   As pointed out by dear @sagkhis in the comments, forcing every >95MB file to be cut into 5-minute pieces can be frustrating for those downloading movies or large archives (like APKs) who prefer standard `.001` archive joining. But ...

How we resolved this: Inspired entirely by your PR, I have rewritten the core logic in the latest commit. Instead of replacing 7z, I added a UI Dropdown (split_method) so users can choose between standard 7z Archive or Video Chunks. Furthermore, for the video chunking, I implemented ffmpeg -f segment -segment_time 300 which splits the video natively, safely, and instantly without corrupting the headers or needing a fallback loop.

I am closing this PR, but I want to give you full credit for sparking this feature. Thank you again for your valuable contribution and for helping make this repository better 🩶🤚🏿

thank you so much for your kind and detailed review. I'm honestly just glad that I could be helpful — even if it was just an idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants