Hello,
I hope you can help me with this. I am trying to find a simple way to merge videos clips by using a list of file paths of these videos. For example:
C:\Video Files\Coral.mp4
C:\Video Files\Coral1.mp4
C:\Video Files\Coral2.mp4
C:\Video Files\Coral3.mp4
C:\Video Files\Coral4.mp4
Would you have a good solution for me? Thank you!
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 17 of 17
Thread
-
-
You can use ffmpeg concat demuxer with a text file
https://trac.ffmpeg.org/wiki/Concatenate#demuxer
Code:ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.mp4
-
Thank you for the solution. However, I have issues with the end results. The video has some lagging, with random pauses, and some clips are replaced by black screens. I precise that the clips have different frame rates, and even resolutions. Is there something I can add to the command line to help this?
-
Different resolutions is a problem - you will have issues muxing, playing on various platforms . It will be inconsistent at best . Theoretically it's possible with a transport stream, but some players might still have problems
If you want it to reliably playback everywhere without problems, you need a uniform resolution - this means re-encoding at least some of them, then running the concat demuxer
Different frame rates are not a problem per se - the concat demuxer will produce a VFR (variable frame rate) output
"Easiest" way would be to drop them on a NLE timeline, and let it handle the conversions automatically
"Best" way would be to analyze each one, in the context of the desired output, and customize the transform applied to each clip -
I don't know
Not sure how to import a simple list of file locations in an editor. A XML or EDL is much differently formatted, much more complicated, but includes all the edits along with the clip references
Normally you'd import a folder, or shift select. But if they were in various locations, that would become tedious with all the navigation. How many files are you dealing with ?
When you use a NLE, understand that likely you're going to be re-encoding all of them (quality loss, unless you use a lossless codec but that will massively increase the filesize), and conformed to a single specification (frame rate, resolution) . Sometimes the "auto" transform might be undesireable (sometimes there are better ways to do it, in terms of quality) -
You could possibly do it in an avisynth script, but depending on what you files were, how many, what type of video you wanted to end up with, there might be other problems
What types of framerates and resolutions do you have ?
E.g. if you wanted to conform to 1280x720, 30/1 FPS , where the framerate conversion inserted duplicates or deleted frame to achieve the desired framerate - it might look something like this
Code:A = FFmpegSource2("C:\Video Files\Coral.mp4", atrack=-1).Spline36Resize(1280,720).ChangeFPS(30) B = FFmpegSource2("C:\Video Files\Coral1.mp4", atrack=-1).Spline36Resize(1280,720).ChangeFPS(30) C = FFmpegSource2("C:\Video Files\Coral2.mp4", atrack=-1).Spline36Resize(1280,720).ChangeFPS(30) . . . A ++ B ++ C ++....
Then you 'd just encode that script in some program like ffmpeg, or staxrip, or megui, or anything that accepts avs scripts -
I'm working with thousands of small clips (1 to 3 seconds). If I manually import these clips in my editor (Resolve primarily) and render, no matter the differences of resolutions and frame rates between clips, the output file is stable, and all converted to fit the default resolution if it is in a smaller resolution.
I thought ffmpeg could do the same. So maybe I need to find an editor that can import the clips with a file paths lists. But which one can do so? I have no idea what is the format of a xml for Resolve. Is it very complex?Last edited by vmackey; 23rd Jul 2023 at 17:17.
-
Yes - the NLE method is the easiest .
But are the 1000's of clips all in different locations, folders ?
I thought ffmpeg could do the same.
I don't think you can add other commands like -vf scale , fps etc.. to conform them like a NLE timeline for concat protocol or demuxer .
So maybe I need to find an editor that can import the clips with a file paths lists. But which one can do so? I have no idea what is the format of a xml for Resolve. Is it very complex?
I think xml is going to be too complicated for your situation. Just export a .xml from a previous project and open in a text editor to get an idea if this will work for you -
I tried to get DavinciResolve XML and look at it, but it is too difficult to construct, but there might be another way:
https://forum.blackmagicdesign.com/viewtopic.php?f=21&t=129242
DavinciResolve project can be constructed thru python API module called DavinciResolveScript.py that comes with Davinci supposedly. The way I understand it, you open DavinciResolve, perhaps empty project and then you run your custom script (that reads your list files) and constructs timeline from your clips. So it can live communicate with current Davinci open project. Or you just open default Davinci project with your custom python script and construct timeline afterwords from that video list. Doing that just by one click, it sounds amazing, but that is based just on watching that video, did not test it myself, I do not have or use Davinci Resolve. -
It might require Fusion for Davinci Resolve, not sure, that would be a problem, or is it a part of paid Davinci Resolve version? Don't know.
-
-
Thanks Al! It seems great. And I do have the Fusion tab on my free version.
I actually found this thread here about someone coding the very thing we are talking about. https://python-forum.io/thread-32308.html However I am not familiar with python or resolve's API (I'm not a coder), so I am not sure where to begin. -
It might take some time, sure, might not go with it I definitely might look into that later (winter projects), to see if it is possible like to export a project by scripting as well, that would be awesome.
Learning python would be a start, it would make things easy. If not knowing python syntax, it might be difficult to understand procedures. The same happens with vapoursynth users (using avisynth before, not knowing python, just guessing syntax, but going back to avisynth right away being overwhelmed by a syntax). Downloading python depends on OS then learning basics. How to create a script in a chosen python editor like idle, which is very easy, it comes with python if using windows or pycharm (more difficult) or other editors. You can use even notepad, but that would be hard with no highlights etc. Idle seams ok when you start.
Guy over here explains it very slowly and basics: https://www.youtube.com/watch?v=2ZtkLXDpNhM
-creating a python script that opens empty davinci resolve,
-another script that imports media to Davinci media storage, basically all media from a directory path
-another script that creates a timeline and adds media to it from media storage
-other script that does the same as above but more easily , where a timeline is just created directly from a media storage clips
this video: https://www.youtube.com/watch?v=HmUubTM57tU automatically opens existing davinci project (just some headers, tiff, lower thirds), adds clips, and applies existing coloring (grading using existing drx file):
-script that loads that existing project and adds new timeline with new clips
-another script that adds some grading - davinci drx file ,whis are a sum of effects, color grading previously exported from some project to either all timelines or all clips of just one timelineLast edited by _Al_; 24th Jul 2023 at 18:35.
-
Thanks Al. I will try to check python hoping I won't get too lost learning coding. I'll try to get into it.
Meanwhile, regarding the first solution given (merging with ffmpeg) I have tried to re-process all my files with resolve, and gave to each clip the same resolution and frame rate (1920x1080 - 24fps), but even with this, the output file still has the same lagging issue. Is there another factor that can create these issues with ffmpeg, beside the resolution and frame rate?
Similar Threads
-
How do you merge clips together to appear seamless?
By Guernsey in forum Newbie / General discussionsReplies: 3Last Post: 16th Nov 2021, 03:12 -
How to get File list with file size in a text file?
By iKron in forum Newbie / General discussionsReplies: 8Last Post: 22nd Jul 2021, 22:13 -
a way to download and merge smooth video via its manifest file
By hazdo in forum Video Streaming DownloadingReplies: 3Last Post: 12th Feb 2021, 04:05 -
Get a list of Youtube video titles from a list of URLs
By abolibibelot in forum Video Streaming DownloadingReplies: 3Last Post: 12th Oct 2020, 05:42 -
Merge audio file and image to create a video. Error: "track 1: muxing mp3..
By DennisO in forum Newbie / General discussionsReplies: 3Last Post: 28th Nov 2018, 08:02