Media processing

From E-CURATORS
Revision as of 00:42, 19 December 2019 by Zack (talk | contribs) (Created page with "= Working with video = == Concatenating original video files == The exFAT file system used on microSD cards used by GoPro limits the size of each file to 4GB, so we have to co...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Working with video

Concatenating original video files

The exFAT file system used on microSD cards used by GoPro limits the size of each file to 4GB, so we have to concatenate the automatically-split mp4 files using ffmpeg. See the official supporting documentation for concatenating video files at https://trac.ffmpeg.org/wiki/Concatenate.

This method requires some preparation. You need to create a text file, which we can can simply name mylist.txt, which includes a list of files to be concatenated, in the order in which they are to be merged. The contents of mylist.txt should look something like this:

 file 'file1.mp4'
 file 'file2.mp4'
 file 'file3.mp4'
 ...

It is important to point out that the proper order is not necessarily the way that your finder window orders them. Though I recommend that you check the files manually, the GoPro camera creates files using a predictable file naming scheme. The first file is named something like GOPR0323.MP4, second file is GP010323.MP4, third is GP020323.MP4, with the 4th character increasing with every file that is part of the same series. A new series of files starting with GOPR0324.MP4 will be initiated after recording is stopped and restarted.

After creating your list of videos to be concatenated, run the following command:

 ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.mp4

This reads the list, identifies the locations of each video file based on the path included in mytext.txt, and combines them into output.mp4. The output video file is a bit smaller than the combined size of the input video files for reasons that I do not currently understand, but the quality of the output is virtually indistinguishable from the the inputs.

Cleaning audio

In some cases, static occurs only when people talk, and there are no isolated moments of static that can be isolated and used to target overall noise reduction. In such cases, apply a low pass filter to the whole audio file, which (I think) 'flattens' the low pitch signals and thereby lowers the 'floor', and everything sounds lower in pitch. One side effect of this, however, is that words, especially the tail ends of words, are much softer and may be difficult to differentiate. The way to resolve this would be to do a high-pass filter, which would negate the process just described. Applying a low-pass filter also has the effect of making deeper voices a bit less legible, as this makes higher pitched voices more clear while reducing clarity of low-pitched ones. Might also be an effect of the placement of the microphone (a small-scale doppler effect or something?).

This can be done multiple times for each file, with multiple 'layers' of low-pass filters applied. While transcribing, it may be worthwhile (but perhaps also somewhat tedious) to alternate between different versions with different layering applied.

General tips

Do everything within a single working directory. If you mess up and need to restart, and if you have space on the drive, create an additional working directory and work in that one without deleting the original files. Similarly, keep an additional set of notes for each attempt, and keep them tidy. Comparing the results from previous attempts can help clarify what exactly went wrong, and can help you better understand how FFmpeg works if you're learning as you go like I am.

If you have access to a computer that can be run independently and continuously, it can be used to automate various tasks. Plan out each command in advance and paste them into a text file, in the order in which they are to be completed. Separate each one by a semicolon. Once all commands have been written and pasted into a single block, copy the entire block and paste it into the terminal prompt, and then hit enter. When one command finishes, the next one will begin. Incomplete or incompatible commands will be skipped over, so make sure to write them out properly. Simple errors or typos may cause hiccups, so it may be necessary to supervise the automation from time to time to ensure that things are going smoothly. If the processes are being run remotely, simply SSHing into the remote computer, and then listing files in the working directory with the -lh flags, may suffice, to examine whether the unified block of commands was halted for for any reason or whether certain commands might have been skipped over.

Processing video is both time intensive and computationally expensive. Be patient, and let commands run their course. It might also be a good idea to cut long videos into smaller clips to test things out as a dry run.

Run as few instances of video editing or playback processes as you can in order to process files quicker. Quit VLC, close your web browser and refrain from using graphics-intensive applications, particularly any applications built using electron (see https://josephg.com/blog/electron-is-flash-for-the-desktop/). Free up as much CPU capacity as you can manage.

See also