The clip uploaded to youtube came from two clips from my a119 using ffmpeg to edit the files. I needed to remove the sound from certain sections of the video and then join the video. I was at work, and would prefer NOT to use a graphical video editor. I also wanted to get it up quickly and I find ffmpeg, although it takes a learning curve can produce a result in most cases pretty fast.
Here is how i did the used ffmpeg in Windows.
cmd, to get to prompt
go to the folder where the files are located and do a Dos loop statement where the raw video files are located
Code:
(for %i in (*.MP4) do @echo ffmpeg –i %i –ss 00:00:00.0 –to 00:00:59.9999 –c copy –copyts output\%i) > timecut.bat
The above produces the file timecut.bat which looks something like this.
ffmpeg -i 2017_1027_065136_429.MP4 -ss 00:00:00.0 -to 00:00:59.9999 -c copy -copyts output\2017_1027_065136_429.MP4
ffmpeg -i 2017_1027_065236_430.MP4 -ss 00:00:00.0 -to 00:00:59.9999 -c copy -copyts output\2017_1027_065236_430.MP4
I have my A119 to record one minute file, so I set the end time to be 59.9999. 60 or seconds would cause it fail as the end time exceeds the actual time.
The file is edited in a text editor while using VLC to see where the sound should be set. I made note where I wanted to turn the sound on and off. As the target files are created to another folder, the batch file is modified to create the folder and delete the contents of the target folder
mkdir output
del output\*
ffmpeg -i 2017_1027_065136_429.MP4 -ss 00:00:00.0 -to 00:00:55.4599 -c copy -copyts output\2017_1027_065136_429-a.MP4
ffmpeg -i 2017_1027_065136_429.MP4 -ss 00:00:55.46 -to 00:00:59.9999 -an -c copy -copyts output\2017_1027_065136_429-b.MP4
ffmpeg -i 2017_1027_065236_430.MP4 -ss 00:00:00.0 -to 00:00:20.9999 -an -c copy -copyts output\2017_1027_065236_430-a.MP4
ffmpeg -i 2017_1027_065236_430.MP4 -ss 00:00:21.0 -to 00:00:30.9999 -c copy -copyts output\2017_1027_065236_430-b.MP4
ffmpeg -i 2017_1027_065236_430.MP4 -ss 00:00:31.0 -to 00:00:38.9999 -an -c copy -copyts output\2017_1027_065236_430-c.MP4
As you can imagine, the above has the start and stop time. The parameter "-an" removes sound
Note the first cut is around 55.46 seconds ... I wanted to keep my statement, but remove the discussion in the cabin of our Rav
55.4599 seconds is exactly where I want to keep the audio
I ran timecut.bat, producing files in the folder in about 5 seconds. The file timecut.bat was tweaked a few times to get the sound to turn off on and off at the appropriate times. I changed the time paramter some time to 15 micro seconds to to get the result I wanted.
Then I join the clips. At the dos prompt, go to the output folder and make a file referencing all the files there.
Code:
cd output
(for %f in (*.MP4) do @echo file ‘%f’) > input.txt
The following file (input.txt) is produced.
file '2017_1027_065136_429-a.MP4'
file '2017_1027_065136_429-b.MP4'
file '2017_1027_065236_430-a.MP4'
file '2017_1027_065236_430-b.MP4'
file '2017_1027_065236_430-c.MP4'
Note how the file are in alphabetical order. I intentionally used target file names in timecut.bat to retain chronological order.
To produce a vide file containing all of the above video clips in input.txt, in the order mentioned in input.txt, following ffmpeg command is run
Code:
ffmpeg -f concat -i input.txt -c copy output.mp4
Which produces the file you see on youtube with the two raw file from my A119 edited with the audio turned on and off.
That is produced in about several seconds.
It would have been easier to use a graphical editor, but it would not give the precision to the microsecond I want with removing audio and I find I get a result much faster than using Kdenlive to render a file.
The ffmpeg comands in Linux are almost identical.
Off course the commands to delete files in folder and looping would be different.