Hi VideoHelp community,
Here is my problem and hope someone help me to solve this.
So i have some files like video1.mp4 video1.ass video2.mp4 video2.ass ... , i need to hardsub video1.ass in video1.mp4 and cut video1.mp4 with a start and end time,
and i need to do this for every video and sub, and finally join the created files.
Can i do this with one command in ffmpeg? If not, how to save all created files with same parameters then to use the ffmpeg concat withour reencoding, or how to
merge video files with different video parameters. Thanks anyway.
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 5 of 5
Thread
-
-
Hardsub implies reencoding. Merging video files with different video parameters also most likely involves reencoding.
Perhaps it would be easier to do with an Avisynth script.
Something like :
Code:V1 = DirectShowSource("video1.mp4").TextSub("video1.ass").Trim(50,3500) # cuts video1.mp4 from frame 50 to frame 3500 V2 = DirectShowSource("video2.mp4").TextSub("video2.ass").Trim(0,2800) # cuts video2.mp4 from the first frame (frame count starts from 0) to frame 2800 V3 = DirectShowSource("video3.mp4").TextSub("video3.ass").Trim(800,0) # cuts video3.mp4 from frame 800 to the end V1 ++ V2 ++ V3
Code:ffmpeg -i "V1 + V2 + V3.avs" -c:v libx264 -crf 20 -preset slower -c:a aac "V1 + V2 + V3.mp4"
Code:ffmpeg -i "V1 + V2 + V3.avs" -vn -f wav - | qaac - -o "V1 + V2 + V3.m4a" ffmpeg -i "V1 + V2 + V3.avs" -i "V1 + V2 + V3.m4a" -map 0:0 -map 1:0 -c:v libx264 -crf 20 -preset slower -c:a copy "V1 + V2 + V3.mp4"
-
-
Well, I'm not that far ahead of the beginner level when it comes to the highly intricate world of Avisynth, so I could hardly provide specific tips relevant to a specific situation, beyond what's available on general information pages... But admittedly information is scarce and can be confusing from a complete newbie's point of view.
I'm currently working on a script which you can find here, and which could help you to get a broad picture of how to achieve what you wish to achieve.
There are several ways to convert the framerate in Avisynth. ChangeFPS() simply duplicates or removes frames (it's the most simple and the fastest method but can cause some stuttering / jerkiness on scenes with constant motion), ConvertFPS() blends frames (may improve motion smoothness but blended still frames may look weird), MFlowFPS() interpolates frames (much more complex and therefore slower, can look much better but can also produce ugly artifacts).
There are also several ways to convert the resolution, with a slightly different result, some sharper, some softer (sharpness is generally considered beneficial but it can also add artifacts). I generally use BicubicResize, which seems to be considered a good compromize, but it may not be the best suited for every case.
For instance ChangeFPS(30000,1001) will convert the framerate to 29.97 FPS (30000 divided by 1001), and BicubicResize(1280,720) will convert the resolution to 1280x720.
With AVSPMod you can edit the script with some helpful tips and preview the result right away.
The DirectShowSource() import filter I used in the example above is known to have reliability issues (see “jagabo”'s reply in the thread linked above). I'm not sure which one to recommend with MP4 sources, let's hope someone more experienced chimes in. As far as I know, other filters (except AVISource which doesn't work with MP4 sources) import video and audio separately, which complicates the script (import video, import audio, then mix video and audio with AudioDub), that's why I used DirectShowSource here to provide a relatively simple example.
In this other example, the source files are imported with LSMASHVideoSource / LSMASHAudioSource, with added framarate and resolution conversions, plus a fade-in and a fade-out. It requires the L-SMASH plugin (either put the DLL in the Avisynth Plugins directory, or specify its path at the beginning of the script with LoadPlugin, as below). If the source files are not in the same directory as the script, their complete path must be specified.
Code:LoadPlugin("C:\path\to\lsmash\LSMASHSource.dll") V1v = LSMASHVideoSource("video1.mp4") V1a = LSMASHAudioSource("video1.mp4") V1 = AudioDub(V1v,V1a).ChangeFPS(30000,1001).BicubicResize(1280,720).TextSub("video1.ass").Trim(50,3500).FadeIn(15) V2v = LSMASHVideoSource("video1.mp4") V2a = LSMASHAudioSource("video1.mp4") V2 = AudioDub(V2v,V2a).ChangeFPS(30000,1001).BicubicResize(1280,720).TextSub("video2.ass").Trim(0,2800) V3v = LSMASHVideoSource("video1.mp4") V3a = LSMASHAudioSource("video1.mp4") V3 = AudioDub(V3v,V3a).ChangeFPS(30000,1001).BicubicResize(1280,720).TextSub("video3.ass").Trim(800,0).FadeOut(15) V1 ++ V2 ++ V3
Last edited by abolibibelot; 30th Jan 2020 at 18:10. Reason: removed a statement I wasn't so sure about
Similar Threads
-
Right way to join two different video files using ffmpeg?
By yetanotherlogin in forum EditingReplies: 15Last Post: 25th Jun 2021, 02:25 -
FFMPEG: How do I join multiple videos into 25GB chunks?
By slax65 in forum Video ConversionReplies: 6Last Post: 3rd Oct 2017, 08:43 -
Need to join several MP4 files - mp4box or ffmpeg? Or neither?
By Cyber Akuma in forum Newbie / General discussionsReplies: 0Last Post: 17th Jul 2017, 15:25 -
convert and join in ffmpeg
By jack616 in forum EditingReplies: 11Last Post: 30th Apr 2016, 13:40 -
[SOLVED] How to join MP4 files where some have more than one audio stream?
By yetanotherlogin in forum EditingReplies: 3Last Post: 19th Nov 2015, 04:32