Author Topic: Batch Combining MP4 Files with the same name  (Read 460 times)

xrocker

  • Newbie
  • *
  • Posts: 4
Batch Combining MP4 Files with the same name
« on: January 29, 2018, 12:13:48 AM »
Hi, I am looking for a way to loop several mp4 files that are in the folder, At the moment I just drag and drop the same mp4 file twice to loop it twice or as many times as I want to, and use mp4muxer to save it into new longer mp4 file.

Problem:
Videos are not cross-faded and is time consuming when working with 100s of mp4 files.

I am looking for a solution, if anyone can help me please to create .bat file or suggest me a way of doing this in a batch. Your help will greatly help me.
Thank you.

eumagga0x2a

  • Hero Member
  • *****
  • Posts: 2026
Re: Batch Combining MP4 Files with the same name
« Reply #1 on: January 30, 2018, 12:58:16 AM »
As Avidemux cannot cross-fade, I doubt that any Avidemux-based solution would fit your requirements. Apart from that, Avidemux can both append new and copy/paste already loaded videos, sure (please use the latest nightly for better experience), both graphically and on command line. Depending on what you want to achieve, scripting might be much more time consuming than pressing Ctrl+V a couple of times in Avidemux.

If you just want a video with the same audio to be played in a loop, a lot of video players support this functionality.

xrocker

  • Newbie
  • *
  • Posts: 4
Re: Batch Combining MP4 Files with the same name
« Reply #2 on: January 30, 2018, 04:38:05 PM »
Thank you for your response. if crossfade is not possible. is there any script that can loop the video couple of times?
Ctrl+ V is not an option for me considering I have 100s of videos if not 1000s that I have to work on every now and often..
Thank you

Jan Gruuthuse

  • Hero Member
  • *****
  • Posts: 6001
Re: Batch Combining MP4 Files with the same name
« Reply #3 on: January 31, 2018, 08:40:00 AM »
the script would just need to parse through the directory
load in avidemux the found "video file name"  and append the same "video file name"
then re-encode the whole thing, key frame issues when the video does not end on keyframe.
I am not that fluent any more in scripting. Perhaps someone else could pick up on this.


not certain if this would be allowed or how to split this so you would have
Code: [Select]
for %%f in (*.avi) do %avidemux% --load "%%f" --append "%%f" --run "SomeSettings.py" --save "%%f.mp4" --quit
or how to split this so you would have something like in your script:
Code: [Select]
do (
%avidemux% --load "%%f"
%avidemux% --append "%%f"  --run "SomeSettings.py" --save "%%f.mp4"
)
« Last Edit: January 31, 2018, 09:56:40 AM by Jan Gruuthuse »

xrocker

  • Newbie
  • *
  • Posts: 4
Re: Batch Combining MP4 Files with the same name
« Reply #4 on: January 31, 2018, 10:44:55 AM »
thank you for your answer... but is there no way to avoid reencoding.. This takes time.. and when I save looped video manually I use mp4muxer to copy th e2 video clips into 1 single video clip without encoding again.. This saves time and resources a lot..

Jan Gruuthuse

  • Hero Member
  • *****
  • Posts: 6001
Re: Batch Combining MP4 Files with the same name
« Reply #5 on: January 31, 2018, 12:30:40 PM »
You could try using [copy] mode. If the video clip does not end on key frame, it will have issues when playing the 2nd part of the new video.

xrocker

  • Newbie
  • *
  • Posts: 4
Re: Batch Combining MP4 Files with the same name
« Reply #6 on: January 31, 2018, 10:21:45 PM »
Thank you, I will try this later tomorrow and report.