Skip to content

Commit aac9893

Browse files
20250612 - ffmpeg additions and headings
1 parent 05d708a commit aac9893

File tree

1 file changed

+37
-7
lines changed

1 file changed

+37
-7
lines changed

video-editing.Rmd

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
title: "Video Editing"
33
---
44

5-
# Avidemux
5+
# Avidemux {#avidemux}
66

7-
## General Video Editing
7+
## General Video Editing {#generalVideoEditing}
88

99
- Search the computer for the *Avidemux* program.
1010
- <u> To combine videos: </u>
@@ -28,7 +28,9 @@ title: "Video Editing"
2828
1. Go to *Avidemux* and clear program workspace (File > Close).
2929
1. Repeat steps 1-5 until you have created all the clips needed.
3030

31-
## Combining Videos
31+
## Combining Videos {#combiningVideos}
32+
33+
### Stitching Two Videos Together Side-By-Side {#sideBySideVideos}
3234

3335
LV1 videos should be a side-by-side combination of recordings from Cameras 1 and 2 in the LV1 Experimenter Room.
3436
The Observation Room computer has been set up to combine these recordings into one video file when it saves.
@@ -47,6 +49,15 @@ When it is done, there will be a saved video file named "Combined.mp4" in the sa
4749
NOTE: This script will only work if you open the Lab Drive directly from the Desktop to navigate to the Side by Side folder.
4850
*You cannot open it from the Quick Access menu in File Explorer.*
4951

52+
An alternative approach is to use [ffmpeg](https://ffmpeg.org) (https://unix.stackexchange.com/a/437044; archived at: https://perma.cc/DWR8-4LST).
53+
Using Command Prompt (`cmd.exe`), use the following syntax when in the target directory (use `cd DIRECTORY` to navigate to the target directory):
54+
55+
```bash
56+
ffmpeg -i left.mp4 -i right.mp4 -filter_complex hstack output.mp4
57+
```
58+
59+
### Stitching Two Videos Together One After The Other {#stitchingVideosOneAfterOther}
60+
5061
In the event that an LV1 video recorded side-by-side but the video was interrupted, resulting in two separate side-by-side video files that stop and start in the middle of a visit (e.g., if the camera box is accidentally kicked off during a visit, if the cameras crash and have to be restarted during the visit, etc.), they can be combined into one video file using Avidemux.
5162
See the "Cute Moments Videos" section of the School Readiness Wiki for a description of how to use this program.
5263
To combine two videos from a visit with interrupted recordings, follow these steps:
@@ -57,8 +68,27 @@ To combine two videos from a visit with interrupted recordings, follow these ste
5768
1. Drag the second video from the File Explorer Window straight into the Avidemux window, dropping it over the first video—you should see the video duration increase when it is added, indicating it is appending to the end of the previous video
5869
1. Save the new video in the TC's folder as TCID_Wave_LV1 (`\\lc-rs-store24.hpc.uiowa.edu\lss_itpetersen\Lab\Studies\School Readiness Study\Videos\Lab Visit 1\`)
5970

60-
# Handbrake
61-
## Cutting and Creating Clips
71+
An alternative approach is to use [ffmpeg](https://ffmpeg.org) (https://ma.ttias.be/use-ffmpeg-combine-multiple-videos/; archived at: https://perma.cc/F9P9-KS4D):
72+
73+
First, using Command Prompt (`cmd.exe`), create a text file named `files.txt` in the same directory as the videos you want to combine (use `cd DIRECTORY` to navigate to the target directory) with the following content:
74+
75+
```bash
76+
cat files.txt
77+
file 'file 1.mp4'
78+
file 'file 2.mp4'
79+
file 'file 3.mp4'
80+
file 'file 4.mp4'
81+
```
82+
83+
Then, run the following command in the Command Prompt to combine the videos listed in `files.txt` into a single output file named `output.mp4`:
84+
85+
```bash
86+
ffmpeg -f concat -safe 0 -i files.txt -c copy output.mp4
87+
```
88+
89+
# Handbrake {#handbrake}
90+
91+
## Cutting and Creating Clips {#cuttingAndCreatingClips}
6292

6393
When a video requires cutting and subsequent clips must be created, the software, Handbrake, should be utilized.
6494
Handbrake allows for easy creation of video clips in .mp4 format from a source video in the .mp4 format.
@@ -87,7 +117,7 @@ Also verify that the name ends in `.mp4`
87117
1. After selecting the save location for the video, at the top of the Handbrake display, select the large green play button titled, `Start Encode`, in order to create the clip
88118
1. Upon completion of encoding, view the created video in order to ensure the clip was successfully made with desired start and end times
89119

90-
### Creating Multiple Clips from the Same Video Simultaneously
120+
### Creating Multiple Clips from the Same Video Simultaneously {#creatingMultipleClips}
91121

92122
Multiple clips can be made from the same source video and processed simultaneously in Handbrake.
93123
<br>
@@ -113,7 +143,7 @@ Ensure the start and end times are changed appropriately for each clip and the f
113143
1. Once all clips desired to be made have been added to the queue, select the large green play button titled, `Start Queue`, in order to create all the clips listed within the queue
114144
1. Upon completion of encoding, view the created videos in order to ensure the clips were saved to the correct file location(s) and each clip was successfully made with desired start and end times
115145

116-
# Converting Media Files to .mp4
146+
# Converting Media Files to .mp4 {#convertToMp4}
117147

118148
To convert video of alternate file type to .mp4, complete the following steps:
119149

0 commit comments

Comments
 (0)