Is there an easy way to duplicate a very short movie clip so that it last longer?

Hello,

I have several very short movie clips. They are just a few ms long (basically an image).

Playing this clip in Plex do not show anything since the clip is so short, so I’d like to duplicate it so it last for at least a minute.

I can do this in MKVToolNix but only in a way that takes a very long time.

Do you know if there is an easier method where I for example can ask the file to be duplicated as many times it has to until it is a minute long?

In Plex, no, you cannot do that. MKVToolNix(GUI) is obviously the best way. What takes you so long with it? It literally should take seconds. Drag-and-drop, drag-and-drop, etc.

What takes long is the process:

1 - File into MKVToolNIX

2 - Right click - add files

3 - Select the file

4 - Repeat

It is a lot of steps. I cant just drag and add. Then I get the popup asking what to do with the file. Takes even longer…

You can with the Windows version.

When you drag in the second file (or multiple files) you should get a pop up. One of the choices is to append to current.

Yes, you are correct.

I can the same, however I still have to click OK every time.

It is not possible to “always use this setting” on that particular case

I think the point we’re saying is that Plex itself does not have a mechanism to do this.

If you want a short clip to repeat, consider doing doubling. Append the file a few times, then create the file. Open this new file, and append itself to itself a few times, then create the file. Open this NEW new file and (etc etc). repeat. This has the effect of appending the file to itself a few hundred times while only having to append it a handful of times.

Come to think of it, you might be able to script this… Do the work of appending a file to itself, but before submitting go to the upper menu and expand the “Multiplexer” option, and click on “Command Line”. This will show the actual command line MKVToolNix uses to run itself. I plopped a file onto itself and this is what it spat out, with hard returns to separate each command:

"C:\Program Files\MKVToolNix\mkvmerge.exe" 
--ui-language en 
--output ^"PATH_TO_OUTPUT_FILENAME^" 
--no-subtitles 
--no-chapters 
--language 0:en 
--display-dimensions 0:1920x1080 
--language 1:en 
^"^(^" ^"PATH_TO_FILE_1^" ^"^)^" 
--no-subtitles
--no-chapters
 + ^"^(^" ^"PATH_TO_FILE_2^" ^"^)^" 
--track-order 0:0,0:1 
--append-to 1:0:0:0,1:1:0:1

I do not know how the --append-to 1:0:0:0,1:1:0:1 command is parsed, so I do not know how to add more files…

Hmm…

Ok, reading the documentation in section 2.5, if the IDs are not specified, MKVToolNix will append using the matching ID’s using a “Video:Video” and “Audio:Audio” append styling. At this point, it seems to claim you can simply do mkvmerge -o output.mkv part1.mkv +part2.mkv

Since your files are identical, and probably have nothing but the video track. So you could do something like this:
mkvmerge -o output.mkv INPUT.mkv +INPUT.mkv +INPUT.mkv +INPUT.mkv +INPUT.mkv +INPUT.mkv +INPUT.mkv +INPUT.mkv +INPUT.mkv +INPUT.mkv +INPUT.mkv +INPUT.mkv +INPUT.mkv +INPUT.mkv +INPUT.mkv +INPUT.mkv +INPUT.mkv +INPUT.mkv +INPUT.mkv +INPUT.mkv +INPUT.mkv +INPUT.mkv

Paste +INPUT.mkv as many times as you want. More complex scripts could automate the pasting of “INPUT” based on reading the length of the original file, and multiplying the input file until the overall length of the output file reached a certain pre-specified length.

2 Likes

Thank you Divideby0,

I really appreciate your suggestion. It might be a bit too advanced for me as I do not know much about scripting. I’ll try another metode here and see if that works. If not I’ll give your suggestion a try.

Scripting has a bad rap. I am nowhere near the level of being able to call myself a scripter, but I do know basic Command Prompt typing. In this case though, making this script is pretty easy:

  • Open a new text file in notepad, and paste the following into it:
    "C:\Program Files\MKVToolNix\mkvmerge.exe" -o output.mkv INPUT.mkv
  • Change output.mkv to whatever filename you want. It can be a nice short name, temporary for now.
  • Change INPUT.mkv to be the name of your current video file. If you have spaces in the filename, I think you can just put the filename in quotes like "INPUT FILENAME.mkv", but I’d suggest changing the filename to a simple no-space name like INPUT.mkv.
  • For each time you want to append a file to itself, add +INPUT.mkv to the end of the text. Note that there is a space before the +INPUT.mkv, because commands in DOS are space separated.
  • Save the text file, then close notepad. Find your file, and change the .txt at the end to .bat, confirm the Windows warning, and POOF it is a script file.
  • Run the script by double clicking.

If you do not have the INPUT file in the same folder as the script file, you must put the whole path to your input filename in INPUT.mkv for the script to find it. I use a temp directory I called “Temp” (year, real imaginative) on my D: drive, do the path would be D:\Temp\INPUT.mkv if that is where my video is at. Probably simpler if you copied your input file to this directory as well when doing the script.

I tested this with an old “charades.avi” file I had lying around from the early internet days. It appended so easily, and MkvToolNix had no problem taking an old .avi file instead of .mkv. My test script is simply:
"C:\Program Files\MKVToolNix\mkvmerge.exe" -o test.mkv charades.avi +charades.avi

Thank you! I’ll test this tomorrow.

Only “issue” I can see right now is that I will probably need very many +INPUT.mkv files

I did what you suggested earlier and first added the file 10 times. Then added this new file 10 files and so on.

I want a file only 40-50 ms long to be somewhere between 2-5 minutes long.

MKVToolNix GUI will let you append multiple files and merge them, with correct timing and seams, into one output file.

This is me showing taking

  1. The original
  2. Appending it to itself (right click on it to append)
  3. Appending something elese

If the file in question is “basically an image” why not extract a frame and put all these things in a photos library?

Yes, thank you. I’m aware of this, however when the file in question is only 40-50 ms long, I’d have to do this hundreds of times to get a clip just a few minutes long.

And when I have quite a few of these files that I’d like to increase from 40-50 ms to 3-5 minutes it would take forever…

Yes, I have been thinking of this, however there are three issues I’ve come across:

1 - I do not know how to get a still image from a blu-ray disc or the mkv files that I’ve extracted using MakeMKV

2 - These files are TV test image files (a lot of them), and I suspect they should remain as original as possible. I fear creating images out of them they could be corrupted somehow…

3 - I will, in any case, need to display these on a TV to be able to adjust the settings of the TV and making longer clips of them seem to me the best way to do this…

copy /b movie1.mpg + movie2.mpg + movie3.mpg movie4.mpg 

Takes you a couple of seconds to copy the OG file to many copies in file explorer. Highlight, ctrl+c then press ctrl+v for as many you want, then use the command line above to copy them all to one file.

Of course if you’re not on windows this want work the same way :smiley:

It will still take a lot of copying since I would need hundreds of these small video files?

You won’t need to duplicate the file for the script. You paste the name of the one file into the script a few hundred times. Easy to do if you just hold down CTRL-V for a few seconds, though easy to lose track of how many times you pasted if you do it this way…

You can CTRL-V 10 times to place 10 input lines, stop, then go back and copy the 10 lines you pasted, then paste this new 10-line text 9 times, and you are now at 100. This is similar to how you appended the file 10 times in the GUI of MKVTools, then did a new file with the 10x file appended 10 more times.

With ffmpeg you can extract a single image, and this could be scripted so you don’t have to do it manually over and over. It should not be corrupted with respect to playing the video file, ffmpeg is the toolbox behind nearly every video app we use.

You could probably prove this to yourself by making a video version and comparing it to an image version.

Though, if these files include HDR metadata then they have to stay as videos.

I was able to solve this using a combination of your suggestions.

I first added the source file til MKVToolNix

Then I copied the source file 10 times using Ctrl-C Ctrl-V in WIndows Explorer

Then I marked all 10 copies and dragged them over to MKVToolNix and told the program to append the files.

The current file was then multiplexed.

The new file created was also duplicated 10 times

Those new files where also appended to MKVToolNix and so on.

After about 45 seconds from start to beginning I had a file from 40-50 ms to about 5 minutes in length :slight_smile:

Thank you all for your valuable contribution!

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.