<p>I would like to answer my own question.</p>
<p>One thing tho is the file is quite large (370+ lines) so i have added it to pastebin</p>
<p><a href="https://pastebin.com/Trkxjkrw" rel="nofollow noreferrer">FF Fader on Pastebin</a></p>
<p>A few Notes:</p>
<p>I had errors popping up if the cuts were certain lengths like on a 30 sec video and I wanted over 10 sec  cuts it would work but toss up errors such as</p>
<pre><code>Invalid number.  Numeric constants are either decimal (17),
hexadecimal (0x11), or octal (021).
Invalid number.  Numeric constants are either decimal (17),
hexadecimal (0x11), or octal (021).
</code></pre>
<p>this error would be cause form the calculations at lines:
218 to 229</p>
<p>lines 218 - 229 were added by another issue i found was if you did a 6 sec segments, the last cut was shorter than 2 seconds  so if that was the case i would need to concat that way cause it was concating (sp?) that last clip twice</p>
<p>If that is not correct way of answering the question here, please help me fix it b4 down voting me etc.  I am new here</p>
<p>I would love some input and if you see where it can be cleaned up that would be great too</p>
<p>EDIT:</p>
<p>Wanted to add that taking a 30 second video and cutting into 3 segments, then cutting those 3 segments into 3 sections.  add the fade in and fade out and then combine them all back into segments  took right at 30 seconds or less!</p>
<p>That is pretty awesome! I think maybe using &quot;threads&quot; on ffmpeg could speed it up  but I am not sure you need it any faster than that.  If you have a idea to speed up ffmpeg more let me know in the comments.</p>

CC BY-SA 4.0
2020-12-18T21:08:49.067Z
2020-12-18T21:16:59.833Z
2020-12-18T21:16:59.833Z
hammer head down
<p>so i am using the following code to  in a windows .BAT file to cut up a video at X time:</p>
<pre><code>bin\ffmpeg -hide_banner -loglevel 0 -i &quot;%video%&quot; -c copy -map 0 -f segment -segment_time %segment_time% -reset_timestamps 1 -segment_format_options movflags=+faststart out%%03d.mp4
</code></pre>
<p>No issues there.</p>
<p>I then add a fade in and fade out to those segments using the following code:</p>
<pre><code>for %%a in (out*.mp4) DO bin\ffmpeg -hide_banner -loglevel 0 -i &quot;%%a&quot; -vf &quot;fade=t=in:st=%segment_fade_in%:d=%segment_fade_duration%,fade=t=out:st=%segment_fade_out%:d=%segment_fade_duration%&quot; -af &quot;afade=t=in:st=%segment_fade_in%:d=%segment_fade_duration%,afade=t=out:st=%segment_fade_out%:d=%segment_fade_duration%&quot; -async 1 fade_%%~na.mp4 
</code></pre>
<p>again NO issue here at all</p>
<p>what i am finding is that it takes a lot of time to add these fade in and fade outs.</p>
<p>So i was thinking of then cutting each of the segments,  for say 2-3 seconds at the front and end of the video file adding the fade in or the fade out and then just concat them back together.</p>
<p>not asking for the code but a method that would not take me days to work on only to find it wont work. looking to see if anyone has done similar to save time</p>
<p>on videos over 20-30 seconds or less its not that big of deal but when the videos in the folder are 5-24 minutes it has to be way faster to cut them up.</p>

<ffmpeg><windows>
FFmpeg on windows cut and fade question
hammer head down
# FFmpeg on windows cut and fade question

(Asked by: username_0 on 2020-12-15)

so i am using the following code to  in a windows .BAT file to cut up a video at X time:
bin\ffmpeg -hide_banner -loglevel 0 -i "%video%" -c copy -map 0 -f segment -segment_time %segment_time% -reset_timestamps 1 -segment_format_options movflags=+faststart out%%03d.mp4

No issues there.
I then add a fade in and fade out to those segments using the following code:
for %%a in (out*.mp4) DO bin\ffmpeg -hide_banner -loglevel 0 -i "%%a" -vf "fade=t=in:st=%segment_fade_in%:d=%segment_fade_duration%,fade=t=out:st=%segment_fade_out%:d=%segment_fade_duration%" -af "afade=t=in:st=%segment_fade_in%:d=%segment_fade_duration%,afade=t=out:st=%segment_fade_out%:d=%segment_fade_duration%" -async 1 fade_%%~na.mp4 

again NO issue here at all
what i am finding is that it takes a lot of time to add these fade in and fade outs.
So i was thinking of then cutting each of the segments,  for say 2-3 seconds at the front and end of the video file adding the fade in or the fade out and then just concat them back together.
not asking for the code but a method that would not take me days to work on only to find it wont work. looking to see if anyone has done similar to save time
on videos over 20-30 seconds or less its not that big of deal but when the videos in the folder are 5-24 minutes it has to be way faster to cut them up.

**Tags:** ffmpeg, windows


---

## 1 answers

### Answer by username_0 on 2020-12-18. Score: 0

I would like to answer my own question.
One thing tho is the file is quite large (370+ lines) so i have added it to pastebin
FF Fader on Pastebin
A few Notes:
I had errors popping up if the cuts were certain lengths like on a 30 sec video and I wanted over 10 sec  cuts it would work but toss up errors such as
Invalid number.  Numeric constants are either decimal (17),
hexadecimal (0x11), or octal (021).
Invalid number.  Numeric constants are either decimal (17),
hexadecimal (0x11), or octal (021).

this error would be cause form the calculations at lines:
218 to 229
lines 218 - 229 were added by another issue i found was if you did a 6 sec segments, the last cut was shorter than 2 seconds  so if that was the case i would need to concat that way cause it was concating (sp?) that last clip twice
If that is not correct way of answering the question here, please help me fix it b4 down voting me etc.  I am new here
I would love some input and if you see where it can be cleaned up that would be great too
EDIT:
Wanted to add that taking a 30 second video and cutting into 3 segments, then cutting those 3 segments into 3 sections.  add the fade in and fade out and then combine them all back into segments  took right at 30 seconds or less!
That is pretty awesome! I think maybe using "threads" on ffmpeg could speed it up  but I am not sure you need it any faster than that.  If you have a idea to speed up ffmpeg more let me know in the comments.


---

