| 1 | #!/bin/bash
|
|---|
| 2 |
|
|---|
| 3 | set -e
|
|---|
| 4 |
|
|---|
| 5 | #Clean
|
|---|
| 6 | rm -rfv /tmp/testsrc.mp4 /tmp/encoding.testsrc-OK.mp4 /tmp/encoding.testsrc-KO.mp4
|
|---|
| 7 | rm -rfv /tmp/encoding.testsrc-OK.mp4.png /tmp/encoding.testsrc-KO.mp4.png
|
|---|
| 8 |
|
|---|
| 9 | #Create samples
|
|---|
| 10 | ffmpeg -loglevel error -f lavfi -i testsrc -vf "scale=1920:1080" -aspect 1920:1080 -t 10 -pix_fmt yuv420p /tmp/testsrc.mp4 -y
|
|---|
| 11 |
|
|---|
| 12 | #Run ffmpeg 1
|
|---|
| 13 | ffmpeg -i "/tmp/testsrc.mp4" -filter_complex '[0:v]copy[vr0]' -map '[vr0]' -vcodec libx264 -b:v:0 800K -profile:v baseline -pix_fmt yuv420p -preset "veryfast" -f mp4 "/tmp/encoding.testsrc-OK.mp4" -loglevel error -y
|
|---|
| 14 |
|
|---|
| 15 | #Run ffmpeg 2
|
|---|
| 16 | ffmpeg -i "/tmp/testsrc.mp4" -filter_complex '[0:v]copy[vr0]' -map '[vr0]' -vcodec libx264 -b:v:0 800K -profile:v baseline -pix_fmt yuv420p -preset "veryfast" -f tee "[select=\'v:0\':f=mp4]/tmp/encoding.testsrc-KO.mp4" -loglevel error -y
|
|---|
| 17 |
|
|---|
| 18 | #Compare results
|
|---|
| 19 | ffmpeg -loglevel error -ss 00:00:05 -i /tmp/encoding.testsrc-OK.mp4 -vframes 1 -q:v 0 /tmp/encoding.testsrc-OK.mp4.png -y
|
|---|
| 20 | ffmpeg -loglevel error -ss 00:00:05 -i /tmp/encoding.testsrc-KO.mp4 -vframes 1 -q:v 0 /tmp/encoding.testsrc-KO.mp4.png -y
|
|---|
| 21 | compare /tmp/encoding.testsrc-OK.mp4.png /tmp/encoding.testsrc-KO.mp4.png -compose src /tmp/diff.png || echo Files differ
|
|---|