VideoHelp Forum
+ Reply to Thread
Results 1 to 4 of 4
Thread
  1. Member
    Join Date
    May 2015
    Location
    toside
    Search Comp PM
    i'm using mkvmerge for split my video files with this batch code on windows

    Code:
    for %%a in ("*.mp4") do "C:\Program Files (x86)\MKVToolNix\mkvmerge.exe" -o ""F:\otpt\%(title)s.%(ext)s"\%%a" --split duration:840s "%%a"
    pause
    how to use same command on ubuntu?
    Last edited by nie-do; 11th May 2015 at 12:23.
    Quote Quote  
  2. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Search Comp PM
    Something like

    Code:
    #!/bin/bash
    for name in /videofolder/*.mp4; do
      /path/to/mkvmerge -o "/newvideofolder/${name%.*}.mp4" -split duration:840s  "$name"  
    done
    Google bash file loop for more guides.
    Quote Quote  
  3. Member
    Join Date
    May 2015
    Location
    toside
    Search Comp PM
    Originally Posted by Baldrick View Post
    Something like

    Code:
    #!/bin/bash
    for name in /videofolder/*.mp4; do
      /path/to/mkvmerge -o "/newvideofolder/${name%.*}.mp4" -split duration:840s  "$name"  
    done
    Google bash file loop for more guides.
    thanks for the hint

    This is working:

    Code:
    #!/bin/bash
    
    for i in *.mp4
    do
        i="${i%.mp4}"
        mkvmerge -o "$i.mkv" "$i.mp4" --split duration:600s
    done
    Quote Quote  
  4. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Search Comp PM
    Great!

    I was just guessing...the ${} can be a bit confusing. And I missed that you should of course output as mkv in mkvmerge.
    Quote Quote  



Similar Threads

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