forked from LuisaFer2046/summer-school-2024
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tuesday_01.html
765 lines (632 loc) · 26.1 KB
/
tuesday_01.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
<!DOCTYPE html>
<html>
<head>
<title>Digital Summer School 2024: TUE01</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" href="../style.css"> </head>
<body>
<textarea id="source">
class: center, middle, titlepage
### TUE01: *Intro to Open Source, Command Line and FFmpeg*
---
class: center, middle, titlepage
### TUE01: *Open Source*
---
class: contentpage
### **Agenda 1**
Introduction to Open Source
> 1.1 The four freedoms
> 1.2 Source code
> 1.3 Evaluating projects
> 1.4 Support models
---
class: contentpage
### **1. Introduction to Open Source**
Open source software is often thought of as free to use, but to be classified as Open a project must meet four criteria for its users.
---
class: contentpage
### **1.1 The Four Freedoms**
- __Freedom to run the programme how you like for any purpose__
- __Freedom to study how the programme works, and make changes for your own use__
- __Freedom to redistribute copies of the original programme to whoever you like__
- __Freedom to redistribute copies of your modified version to whoever you like__
An open source project should provide you with information about the type of licence that governs the use of it.
Advice about open source licences can be found at the [Open Source Initiative](https://opensource.org/licenses)
---
class: contentpage
### **1.2 Source code**
You also need to access the source code. The licence will permit you to make your own copy of the software, to edit and redistribute. Mostly you’ll find source code in Git repositories, like you see here for the FFmpeg libraries.
.left[<img src="https://raw.githubusercontent.com/digitensions/summer-school-2024-local/main/tuesday/images/ffmpeg_source_code.png" width="1000">]
---
class: contentpage
### **1.3 Evaluating projects**
1. Can you avoid adding it? Can you use existing dependencies or software already installed?
*Every new piece of software comes with dependencies and potential security issue.Answer: No, this piece of software is unique in how it losslessly compresses and preserves image sequences.*
2. Are you evaluating the correct version and not a fork of a project?
*There should be an official download site with the latest verion with links to their repositories. Check the website name is exactly correct and the project website link is correct.*
3. If searching for a project, or following a recommendation, do you have the latest version of the software?
*Projects can move, as development teams or hosting shifts. Check the late release date and popularity of the repository. Recent releases and active users points to official released code.*
4. Is the project maintained? Has there been significant recent activity and version releases? Are they supporting user issues?
*Take a look a the issues raised by users and whether they have been successfully resolved, and see how recent these conversations occurred.*
Further guidelines are available from the [Open Source Security Foundation](https://best.openssf.org/Concise-Guide-for-Evaluating-Open-Source-Software.html)
---
class: contentpage
### **1.4 Support models**
**Funded models**
- Bounty driven development
_Independent developers receive bounty payments for feature development or bug fixes_
- User support contracts
_Paid for support contracts help secure regular income for project developers_
- Consulting or expertise
_Experienced developers charge for consultation work_
- Mixed licensing
_Software offers free to use options, but others may require payment_
- Grants and donations
_Payment for development of specific tools, grant funding or gifts_
---
class: contentpage
### **1.4 Support models**
**User support models**
- Writing or editing documentation
_Save time for developers to work on code and not documentation_
- Language translations
_Make the code more accessible for international users_
- Supporting other users
_Peer to peer support saves developers time with basic enquiries_
- Bug finding and testing software
_More user testing helps make the project more robust_
- Promoting and fundraising
_Blogging about your use of software, helping raise money for developers_
---
class: center, middle, titlepage
### TUE01: *Intro to the Command Line and Bash*
---
class: contentpage
### **Agenda 2**
Command Line Interface (CLI)
> 2.1 Unix Terminal
> 2.2 Windows Terminal, Command Prompt or PowerShell
> 2.3 Unix tools on Windows
> 2.4 Useful tools and commands
Bash shell scripting
> 2.5 Special characters and comparisons
> 2.6 Loops and conditional statements
> 2.7 Shebang and script formation
> 2.8 Running and testing code
---
class: contentpage
### **2. Command Line Interface (CLI)**
The Command Line Interface is a text only window set into a Graphical User Interface (or GUI).
.left[<img src="https://raw.githubusercontent.com/digitensions/summer-school-2024-local/main/tuesday/images/2021-02-27_-_ffmpeg_version.gif" width="800">]
---
class: contentpage
### **2. Command Line Interface (CLI)**
A command is an instruction telling the computer how to act, like asking which FFmpeg version is installed
```sh
ffmpeg -version (Unix / Windows)
```
A CLI has a command interpreter (or shell) running within it converting our typed command lines into a language the computer can understand
As you type in a command (echo) with arguments ('Hello World') the shell interpreter reads and executes them
```sh
echo 'Hello World' (Unix)
```
The CLI displays the command you type as well as the result of the command shown below
```sh
echo $0 (Unix)
```
This example of echo is asking the CLI to print out which version of shell is being used, - eg `bash` or `/bin/bash`
---
class: contentpage
### **2. Command Line Interface (CLI)**
.left[<img src="https://raw.githubusercontent.com/digitensions/summer-school-2024-local/main/tuesday/images/Parrot.gif" width="300">]
```bash
curl parrot.live
```
**Why would you want to use the command line?**
- To learn amazing new things like running Party Parrot!
- To install and run open source software
- To use open source software projects that have limited or no graphical user interface
- To run CPU intensive processes in the background while still running day to day software
- To work remotely with servers or virtual machines over networks or in data centres
- To build automated processes and operate more efficiently 👀
---
class: contentpage
### **2.1 Linux and MacOS Terminal (Unix)**
Macintosh and Linux have the same operating system (OS) - Unix. Unix operating systems all use the Terminal CLI.
To launch Terminal in Mac OS:
```Bash
Cmd + Space (and search 'Terminal')
```
To launch a Terminal in Linux OS:
```Bash
Ctl + Alt + T
```
Use the `chsh` command with the `-s` shell flag, followed by the argument `/bin/bash/` to change to Bash:
```Bash
chsh -s /bin/bash
```
To check what version of Bash you are running you can use this command:
```Bash
bash --version
```
---
class: contentpage
### **2.2 Windows Terminal, Command Prompt or PowerShell**
To launch a CLI in Windows Console click `Start`, and in the search:
```Powershell
cmd (Command Prompt) Powershell Windows Terminal
```
**Command Prompt (cmd or cmd.exe)**
The default CLI for older Windows Systems, including Windows 9x and Windows NT
**Powershell**
Powershell is an automated command-line shell with Command Prompt features.
**Windows Terminal**
Windows 10 launched the Windows Terminal in 2019, which provides a choice of interpreters including:
- `Command Prompt - cmd.exe`
- `Powershell`
- `Windows Subsystem for Linux (WSL)`
[Comparison of Command Shells](https://en.wikipedia.org/wiki/Comparison_of_command_shells)
---
class: contentpage
### **2.3 Unix tools on Windows**
Window Subsystem for Linux (WSL) v1 is supported in Windows 10, 11 and Windows Server 2016, 2019 and 2022.
WSL v2 has a full Linux kernel and is available in Windows 10 via the [Windows Insider Programme](https://learn.microsoft.com/en-us/shows/one-dev-minute/learn-how-to-install-wsl-2).
.left[<img src="https://raw.githubusercontent.com/digitensions/summer-school-2024-local/main/tuesday/images/Screenshot 2024-09-12 at 14.25.39.png" width="400">]
[Ubuntu on WSL](https://ubuntu.com/desktop/wsl)
For Windows machine that don't have WSL:
- [Cygwin](https://www.cygwin.com/) has a large collection of open source software tools described as 'Unix like'
- [GNU On Windows (GOW)](https://github.com/bmatzelle/gow/wiki) contains over 100 'extremely useful open source Unix applications'
---
class: contentpage
### **2.4 Useful commands and tools (Unix and Windows)**
<font color="black">Short cut!</font> Press the control button with the letters above to perform shell functions:
```sh
Ctl+C | Ctl+A | Ctl+E | Ctl+B | Ctl+F | Ctl+H | Ctl+D
Break | Move to start of line | Move to end of line | Backspace (no delete) | Forward space | Backspace (delete) | Log out of shell
```
<font color="black">Short cut!</font> Press the tab button can autocomplete a path or command:
```sh
Tab
```
<font color="black">Command:</font> Print parent working directory to console
```sh
pwd (Unix) ch chdir (Windows)
```
<font color="black">Command:</font> List the contents of the current directory
```sh
ls (Unix) dir (Windows)
```
<font color="black">Command:</font> Make a new directory
```sh
mkdir <new_directory_name> (Unix/Windows)
```
---
class: tangentpage
### **Tangent: Absolute and relative paths**
Absolute paths always contain the full path to a file or folder from a hard drive:
```sh
/mnt/qnap/folder1/subfolder2/file.txt
C:\Users\User\Documents\file.txt
```
Relative paths are relative to the current working directory of the CLI (pwd/ch is folder1):
```sh
./subfolder2/file.txt
../
~
```
When naming folders avoid using spaces or special characters:
```sh
FolderForTest (CamelCase example)
folder_for_test (snake_case example)
```
Spaces in paths can break commands, and like special characters are illegal filename characters. Keep it simple!
---
class: contentpage
### **2.4 Useful commands and tools (Unix and Windows)**
<font color="black">Command:</font> Change the current directory you are in
```sh
cd <new_directory_name> (Unix/Windows)
```
<font color="black">Command:</font> Create a `new_file.txt` situated with the current parent directory
```sh
touch new_file.txt (Unix) type nul > new_file.txt (Windows)
```
<font color="black">Command:</font> Move a file or rename it by moving to a different name within the same path
```sh
mv new_file.txt old_file.txt (Unix) move new_file.txt \path\new_file.txt (Windows)
```
<font color="black">Command:</font> Copy a file from one location to another:
```sh
cp new_file.txt /path/new_file.txt (Unix) copy new_file.txt \path\new_file.txt (Windows)
```
<font color="black">Command:</font> Clear the screen of previous command executions
```sh
clear (Unix) cls (Windows)
```
---
class: contentpage
### **2.4 Useful commands and tools (Unix)**
<font color="black">Command:</font> Echo will print arguments to console or to files
```sh
echo "Hello World!" > new_file.txt
```
<font color="black">Command:</font> Cat prints the contents of new_file.txt to the console
```sh
cat new_file.txt
```
<font color="black">Command:</font> Grep search specific phrases within your new_file.txt
```sh
grep "Search" new_file.txt
```
<font color="black">Command:</font> Head can list the first x number lines of a file
```sh
head -10 new_file.txt
```
<font color="black">Command:</font> Tail reads from botton of a file, but using the `-f` flag follows a file as it extends
```sh
tail -f script.log
```
---
class: contentpage
### **2.4 Useful commands and tools (Unix) **
<font color="black">Command:</font> Basename, extracts the basename of a supplied path string whether it's a file or a directory
```sh
basename /mnt/path_to_file/folder (returns folder)
basename /mnt/path_to_file/file.txt (returns file.txt)
```
<font color="black">Command:</font> Dirname, extracts the directories in the path, except the last item whether it's a file or a directory
```sh
dirname /mnt/path_to_file/folder (returns /mnt/path_to_file)
dirname /mnt/path_to_file/file.txt (returns /mnt/path_to_file)
```
<font color="black">Command:</font> Date retrieves the date and time from your operating system
```sh
date "+%Y-%m-%d - %H.%M.%S"
```
<font color="black">Command:</font> Rsync is a powerful tool to copy files to/from a remote host, or local drives.
```sh
rsync -avh /path_one/file.txt path_two/file.txt
```
---
class: contentpage
### **2.4 Useful commands and tools (Unix) **
Manuals are available to help you better understand all these tools. Exit using 'q'
```Bash
man basename
```
.left[<img src="https://raw.githubusercontent.com/digitensions/summer-school-2024-local/main/tuesday/images/man_basename.png" width="700">]
---
class: contentpage
### **2. Bash shell scripting**
.left[<img src="https://raw.githubusercontent.com/digitensions/summer-school-2024-local/main/tuesday/images/Shell_example.png" width="1200">]
---
class: contentpage
### **2.5 Special characters and comparisons**
Comments can be added anywhere using the hash symbol
```sh
# - #Comments here
```
Dollar symbol prefixed names to indicate that there is a value attached and stored in that name
```sh
$ - $name, echo $0
```
Indicates a placeholder used in a search command, or for concatenating variables in strings when prefixed with $
```sh
{} - ${PATH}
```
Tests are expressed between square brackets and return boolean reponses 'true' or 'false'
```sh
[] or [[]] - if [ -z "$name" ]
```
A semicolon allows you to concatenate two or more commands into one line completing each in turn
```sh
; - echo "Hello"; echo "lovely"; echo 'Archivists!'
```
---
class: contentpage
### **2.5 Special characters and comparisons**
Asterisks serves as a 'wild card' and used on its own it matches all filenames in a given directory
```sh
* - find /path/folder/ -name '*.mkv'
```
The pipe `|` passes the standard output of a previous command, such as `echo` to the input of the next
```sh
| - echo "filename.txt" | rev | cut -c 5- | rev
```
The `||` OR operator will keep trying commands in a line until one succeeds. The `&&` AND operator will only continue processing commands if they succeed
```sh
|| && - false || echo 'Hello World!' false && echo "Hello World"
```
Single quotes `'` preserves all special characters in a string, but always use double quotes `"` for quoting paths
```sh
"string" or 'string!'
```
Redirects the standard output (stdout) and standard errors (stderr) of a script into a file
```sh
> >> &> &>> - echo 'Hello lovely Archivists!' >> test.log
```
---
class: contentpage
### **2.5 Special characters and comparisons**
Arithmetic characters plus, minus, divide. Equals can be used in many ways
```sh
+ - % =
```
Equals symbol can be used to populate variables with content, or compare variables match in an `if` test
```sh
a='string1'
b='string2'
if [ "$a" == "$b" ]
```
String comparisons vs mathematic comparisons:
```sh
string | comparison | math
-------|--------------------------|--------
== | is equal to | -eq
!= | is not equal to | -ne
< | is less than | -lt
> | is greater than | -gt
<= | less than or equal to | -le
>= | greater than or equal to | -ge
-n | string is not empty |
-z | string is empty |
```
---
class: contentpage
### **2.6 Loops and conditional statements**
The `find` search and `-exec` argument can loop through results performing the same command repeatedly
```sh
find /mnt/path/folder -type f -name 'N_*' -exec mv {} /mnt/new_path/folder/{} \;
```
For loops will find files in the parent folder, using do and done to control the start and end of a loop
```sh
for file in *.mov; do mv "$file" "/mnt/new_path/folder/${file}"; done
```
While loops will keep completing a set of tasks until the condition of the loop is no longer met
```sh
while [[ "$counter" > 0 ]]; do echo "${counter}"; counter=$(( counter - 1 )); done
```
Arguments of a conditional construct. Depending on the result of `if` the next is selected
```bash
if elif else fi then
```
---
class: contentpage
### **2.6 Loops and conditional statements**
.left[<img src="https://raw.githubusercontent.com/digitensions/summer-school-2024-local/main/tuesday/images/Shell_example.png" width="1400">]
---
class: contentpage
### **2.7 Shebang and script formation**
Create a new shell script simply by making a file with the extension `.sh`
```sh
touch new_script.sh
```
Ensure the permissions of the file will allow you to user to read, write and later execute it
```bash
chmod u+x new_script.sh
```
Use `-l` to view the permissions of your file before and afeter
```sh
ls -l
```
Open that new file and begin writing your script, there are many editing options including
```sh
nano new_script.sh (Ctl+X to exit)
vi new_script.sh (Type :q to exit)
open new_script.sh (Launches file in GUI)
```
---
class: contentpage
### **2.7 Shebang and script formation**
A shebang as your first line provides the shell path for execution
```sh
#! /bin/bash
# Note to say what script does
# Script to check if files in folder and print log to console and $LOG
# Create a variable for the path you want to search
PATH_TO_CHECK="/Users/Joanna/Desktop/test_folder/"
# Create a log variable and use touch to make the file
LOG="${PATH_TO_CHECK}new_log.txt"
touch "$LOG"
cd "$PATH_TO_CHECK"
# Start the for loop searching for any file with an extension use the wild card
# Complete two commands for each file found, print 'Item found: name' to CLI and
# append the name into the $LOG text file
for file in *.*
do
echo "Item found: ${file}"
echo "$file" >> "${LOG}"
done
```
---
class: contentpage
### **2.7 Shebang and script formation**
The same results but this time using the find loop, with a maxdepth setting of 1 to stop it searching in subfolders
```sh
#! /bin/bash
# Note to say what script does
# Script to check if files in folder and print log to console and $LOG
# Create a variable for the path you want to search
PATH_TO_CHECK="/Users/Joanna/Desktop/test_folder/"
# Create a log variable and use touch to make the file
LOG="${PATH_TO_CHECK}new_log.txt"
touch "${LOG}"
# Start a for loop searching for any file with an extension use the wild card
# Set maxdepth to 1 to stop the search looking in subfolders and only find -type 'f', file
find "${PATH_TO_CHECK}" -maxdepth 1 -type f -name '*.*' -exec echo {} >> "${LOG}" \;
```
[Shellcheck.net](https://shellcheck.net) is an excellent resource for testing your shell script is correctly formed before running it live
---
class: contentpage
### **2.8 Running and testing code**
Navigate into the same folder as your script. Call the script prefaced with `./`
```sh
cd script_directory
./new_script.sh
```
To get traces of each line as it's executed and verbose reporting on script runs use `-x` and `-v` after the shebang
```bash
#! /bin/bash -x -v
```
You can also use the `test` command which has lots of options for testing your bash commands
```bash
test -n "$(find "/User/Joanna/Desktop" -maxdepth 1 -type f -name '*.*' -exec echo {} \;)"
echo $?
man test
```
Using POSIX standard ensures your shell scripts are portable between different Unix systems:
[GNU.org Bash-POSIX-Mode](https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Bash-POSIX-Mode)
---
class: center, middle, titlepage
### TUE01: *Intro to FFmpeg, FFprobe and FFplay*
---
class: contentpage
### **Agenda 3**
Introduction to FFmpeg
> 3.1 The basic FFmpeg command
> 3.2 Format defaults
> 3.3 FFprobe and FFplay
> 3.4 Guides and help pages
> 3.5 FFmpeg's FFV1 codec
---
class: contentpage
### **3 Introduction to FFmpeg**
.left[<img src="https://raw.githubusercontent.com/digitensions/summer-school-2024-local/main/tuesday/images/Screenshot 2024-08-27 at 21.13.26.png" width="650">]
- FFmpeg encodes, decodes, muxes and demuxes audiovisual file formats at speed
- It has an extensive list of supported codecs and file formats
- It's open source software and makes projects like VLC, YouTube and iTunes possible
- Hundreds of filters that visualise and analyse complex audiovisual data
- FFmpeg comes with a metadata analysis and extraction tool FFprobe
- Playback of all FFmpeg formats and codecs and live streams is possible with FFplay
- It can be used via the CLI, with third party GUIs or via their own API
---
class: contentpage
### **3.1 The basic FFmpeg command**
This basic FFmpeg video encoding command:
```sh
ffmpeg -i input.mov output.mp4
```
This is also the same for audio files, and image files:
```sh
ffmpeg -i input.wav output.mp3
ffmpeg -i input.tif output.jpg
```
To select a video or audio stream to select a codec use the following flags:
```sh
ffmpeg -i input.mkv -c:v prores_ks -c:a copy output.mov
```
The input.mkv video will be re-encoded to ProRes and the audio codec will be unchanged in the second command. The wrapper will change from Matroska to MOV.
---
class: contentpage
### **3.2 Format defaults**
FFmpeg has default codec selections for audio and video if not specified in a command:
```
Format | Default video | Default audio
-----------|-----------------|----------------
avi | mpeg4 | mp3
mkv | H.264 | ac3
mov | H.264 | aac
mp4 | H.264 | aac
mpg | mpeg1video | mp2
mxf | mpeg2video | pcm_s16le
wav | - | pcm_s16le
```
Credit: [FFmprovisr Codec Defaults for FFmpeg.](https://amiaopensource.github.io/ffmprovisr/index.html#codec-defaults)
It's important to specify exactly what codecs are wanted in the finished file:
```bash
ffmpeg -i input.mkv -c:v v210 -c:a pcm_s16le output.mov
```
---
class: contentpage
### **3.3 FFprobe**
To extract metadata from a video file you can use these commands:
```bash
ffprobe input.mov
ffprobe -hide_banner input.mov
```
You can access lots of different data from your streams using different `show` flags:
```bash
-show_streams
-show_format
-show_packets
-show_frames
ffprobe -v error -select_streams v:0 -show_streams input.mov
```
A command to look at the file's video bitrate for example:
```bash
ffprobe -v error -select_streams v:0 -show_entries stream=bit_rate
-of default=noprint_wrappers=1 input.mov
```
---
class: contentpage
### **3.3 FFplay**
Most FFmpeg commands can be easily modified and run through FFplay:
```bash
ffmpeg -f lavfi -i testsrc=size=1024x576 -t 10 output.mov
ffplay -f lavfi -i testsrc=size=1024x576
```
FFplay using the same libraries used by FFmpeg and can play many formats:
```bash
ffplay input.mov
ffplay input.jpg
ffplay input.wav
```
FFplay can also preview video with overlaid filters:
```bash
ffplay -f lavfi "movie='input.mov', signalstats=out=brng:color=cyan[out]"
```
---
class: contentpage
### **3.4 Guides and help pages**
<font color="orange">Practise:</font> To find out more about FFmpeg look no further than their own manual (q to exit), help pages and their extensive lists of available codecs, formats, encoders, muxers, fitlers, etc.
```bash
man ffmpeg
ffmpeg -h long / full
ffmpeg -version
ffmpeg -codecs
ffmpeg -formats
ffmpeg -muxers
ffmpeg -demuxers
ffmpeg -devices
ffmpeg -encoders
ffmpeg -decoders
ffmpeg -filters
```
[FFmpeg official website](https://ffmpeg.org)
[FFmpeg bug tracker and Wiki pages](https://trac.ffmpeg.org/wiki)
[FFmprovisor](https://amiaopensource.github.io/ffmprovisr/) from The Association of Moving Image Archivists
[FFmpeg, FFprobe and FFplay training](https://training.ashleyblewer.com/) by Ashley Blewer
[Reading FFmpeg logs](https://www.youtube.com/watch?v=15ZUnR3Nx1k) by Ashley Blewer at No Time To Wait! 4
[FFmpeg Cookbook for archivists](https://avpres.net/FFmpeg/) by Reto Kromer
[Introduction to Audiovisual Transcoding, Editing, and Color Analysis with FFmpeg](https://programminghistorian.org/en/lessons/introduction-to-ffmpeg) by Dave Rodriguez
---
class: contentpage
### **3.5 FFmpeg's FFV1 codec**
FFV1 is a lossless video codec that was initially created by the FFmpeg community 21 years ago. Since 2009 it has been used for preservation and funding has been found for its development.
.left[<img src="https://raw.githubusercontent.com/digitensions/summer-school-2024-local/main/tuesday/images/Screenshot 2024-08-26 at 18.15.17.png" width="670">]
---
class: contentpage
### **3.5 FFmpeg's FFV1 codec**
Key FFV1 encoding parameters for preservation use:
```
| Argument | Value | Description |
|---------------|--------|--------------------------------------------------------------------|
| -c:v | ffv1 | Select FFmpeg's FFV1 codec for the output file |
| -level | 1,3 | Select FFV1 version (always 3 for slicecrc/multithreading) |
| -g | >=1 | Reuse context model with group of frames to improve compression |
| -slices | 16, 24 | The amount of slices affects multithreading performance, file size |
| | 64 + | and CRCs embedded. Increasing slices speeds encoding |
| -slicecrc | 0,1 | Activates error detections check of CRCs in bitstream. 0=off, 1=on |
```
```sh
ffmpeg -i input.mov -map 0 -dn -c:v ffv1 -level 3 -g 1 -slices 24 -slicecrc 1
-c:a copy output.mkv
```
.left[<img src="https://raw.githubusercontent.com/digitensions/summer-school-2024-local/main/tuesday/images/Screenshot 2024-09-03 at 16.17.55.png" width="240">]
The FFV1 codec is most frequently paired with the Matroska wrapper. [Matroska](https://www.matroska.org/index.html) is an open source project designed to create container formats able to hold unlimited numbers of video, audio, picture or subtitle tracks in one file. The Matroska project have several containers:
- MKV for video, MKA for audio, MKS for subtitles and MK3D for stereoscopic video.
</textarea>
<script src="https://remarkjs.com/downloads/remark-latest.min.js" type="text/javascript"></script>
<script type="text/javascript">var slideshow = remark.create({ratio: "16:9"});</script>
</body>
</html>