VideoHelp Forum
+ Reply to Thread
Results 1 to 10 of 10
Thread
  1. hello is there any command in FFMPEG we can split .mp4 videos in to multiple parts without re-encode and losing quality etc
    Quote Quote  
  2. Drag/drop onto a batch file:

    Code:
    ffmpeg.exe -i %1 -codec copy -f segment -segment_time 1800 -reset_timestamps 1 "%~n1.%%03d.mp4"
    segment_time is in seconds. An incrementing 3 digit number added to the base name of each segment.
    Quote Quote  
  3. same as jagabo said ...just a tad more explanation that's all

    split video into 3 min equal time interval segments split00.mp4, split01.mp4, split02.mp4, split03.mp4
    ffmpeg -i input.mp4 -c copy -f segment -segment_time 3:00 -reset_timestamps 1 test%02d.mp4

    -reset_timestamps 1 is critical as for each segment it recalculates the time
    %02d outputs 00, 01, 02, 03, etc. change to %03 for 000, 001, 002, 003, etc.
    for an hour use 1:00:00 not 60:00
    Quote Quote  
  4. Originally Posted by jagabo View Post
    Drag/drop onto a batch file:

    Code:
    ffmpeg.exe -i %1 -codec copy -f segment -segment_time 1800 -reset_timestamps 1 "%~n1.%%03d.mp4"
    segment_time is in seconds. An incrementing 3 digit number added to the base name of each segment.
    i dont want to split in minutes , like if its 2 hour 55 minutes video i want to split full video in total 5 parts , not messing around with seconds and minutes
    Last edited by grabyea; 4th Oct 2021 at 18:35.
    Quote Quote  
  5. Perhaps mp4box has a suitable option :
    Code:
     -split time_sec      splits in files of time_sec max duration, starting each file at RAP.
                           * Note: this removes all MPEG-4 Systems media
     -split-size size     splits in files of max filesize kB. same as -splits.
                           * Note: this removes all MPEG-4 Systems media
     -split-rap           splits in files beginning at each RAP. same as -splitr.
                           * Note: this removes all MPEG-4 Systems media
     -split-chunk S:E     extracts a new file from Start to End (in seconds). same as -splitx
                           E may be a number, "end" or "end-N", where N is a number of seconds before the end
                           * Note: this removes all MPEG-4 Systems media
     -splitz S:E          same as -split-chunk, but adjust the end time to be before the last RAP sample
                           * Note: this removes all MPEG-4 Systems media
    Quote Quote  
  6. [QUOTE=grabyea;2633418]
    Originally Posted by jagabo View Post
    i want to split full video in total 5 parts , not messing around with seconds and minutes
    You should have mentioned that in the first post. In a batch file:

    Code:
    ffprobe -v quiet -show_entries stream=duration -of default=noprint_wrappers=1:nokey=1 -select_streams v:0 %1 > "%~dpn1.txt"
    set /p segment_duration= < "%~dpn1.txt"
    del "%~dpn1.txt"
    set /a segment_duration=%segment_duration%%
    set /a segment_duration=%segment_duration%%/5
    
    ffmpeg -i %1 -f segment -segment_time %segment_duration% -reset_timestamps 1 -c copy "%~dpn1.%%1d.mp4"
    pause
    This uses ffprobe to get the duration in a text file then creates and environment variable with the that duration/5. Finally ffmpeg uses that environment variable to split the video file.
    Quote Quote  
  7. [QUOTE=jagabo;2633423]
    Originally Posted by grabyea View Post
    Originally Posted by jagabo View Post
    i want to split full video in total 5 parts , not messing around with seconds and minutes
    You should have mentioned that in the first post. In a batch file:

    Code:
    ffprobe -v quiet -show_entries stream=duration -of default=noprint_wrappers=1:nokey=1 -select_streams v:0 %1 > "%~dpn1.txt"
    set /p segment_duration= < "%~dpn1.txt"
    del "%~dpn1.txt"
    set /a segment_duration=%segment_duration%%
    set /a segment_duration=%segment_duration%%/5
    
    ffmpeg -i %1 -f segment -segment_time %segment_duration% -reset_timestamps 1 -c copy "%~dpn1.%%1d.mp4"
    pause
    This uses ffprobe to get the duration in a text file then creates and environment variable with the that duration/5. Finally ffmpeg uses that environment variable to split the video file.

    ffmpeg -i %1 -f segment -segment_time %segment_duration% -reset_timestamps 1 -c copy "%~dpn1.%%1d.mp4"

    where to put video name? where to add 5 if i want to split in 5 parts?
    Quote Quote  
  8. Originally Posted by abolibibelot View Post
    Perhaps mp4box has a suitable option :
    Code:
     -split time_sec      splits in files of time_sec max duration, starting each file at RAP.
                           * Note: this removes all MPEG-4 Systems media
     -split-size size     splits in files of max filesize kB. same as -splits.
                           * Note: this removes all MPEG-4 Systems media
     -split-rap           splits in files beginning at each RAP. same as -splitr.
                           * Note: this removes all MPEG-4 Systems media
     -split-chunk S:E     extracts a new file from Start to End (in seconds). same as -splitx
                           E may be a number, "end" or "end-N", where N is a number of seconds before the end
                           * Note: this removes all MPEG-4 Systems media
     -splitz S:E          same as -split-chunk, but adjust the end time to be before the last RAP sample
                           * Note: this removes all MPEG-4 Systems media
    thanks i will check
    Last edited by grabyea; 4th Oct 2021 at 19:43.
    Quote Quote  
  9. [QUOTE=grabyea;2633425]
    Originally Posted by jagabo View Post
    Originally Posted by grabyea View Post
    Originally Posted by jagabo View Post
    i want to split full video in total 5 parts , not messing around with seconds and minutes
    You should have mentioned that in the first post. In a batch file:

    Code:
    ffprobe -v quiet -show_entries stream=duration -of default=noprint_wrappers=1:nokey=1 -select_streams v:0 %1 > "%~dpn1.txt"
    set /p segment_duration= < "%~dpn1.txt"
    del "%~dpn1.txt"
    set /a segment_duration=%segment_duration%%
    set /a segment_duration=%segment_duration%%/5
    
    ffmpeg -i %1 -f segment -segment_time %segment_duration% -reset_timestamps 1 -c copy "%~dpn1.%%1d.mp4"
    pause
    This uses ffprobe to get the duration in a text file then creates and environment variable with the that duration/5. Finally ffmpeg uses that environment variable to split the video file.

    ffmpeg -i %1 -f segment -segment_time %segment_duration% -reset_timestamps 1 -c copy "%~dpn1.%%1d.mp4"

    where to put video name? where to add 5 if i want to split in 5 parts?
    You don't do any of that. Just drag/drop a video onto the batch file.
    Quote Quote  
  10. Just found this by chance (while looking for something else) :
    https://superuser.com/questions/1419707/ffmpeg-split-up-mp4-with-variable-duration-int...wo-equal-parts
    It didn't get a reply as thorough as the one above. It was asked more than 2 years ago, but it might be worth it do add a reply and link to this thread.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!