From 4ddbb55eac513c1863a453a8d21cd6c8dc167661 Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Fri, 29 Jan 2016 17:59:34 +0100 Subject: add a global resolution-config for all example-scripts --- example-scripts/config.sh | 5 +++++ example-scripts/ffmpeg/source-avsync-test-clip-as-cam1.sh | 7 ++++++- example-scripts/ffmpeg/source-avsync-test-clip-looped-as-cam1.sh | 7 ++++++- example-scripts/ffmpeg/source-background-loop.sh | 6 +++++- example-scripts/ffmpeg/source-mjpg-framegrabber.sh | 8 ++++---- example-scripts/ffmpeg/source-nostream-music.sh | 3 ++- example-scripts/ffmpeg/source-nostream-pause-loop.sh | 6 +++++- example-scripts/ffmpeg/source-testvideo-as-cam1.sh | 7 ++++++- example-scripts/ffmpeg/source-testvideo-as-cam2.sh | 7 ++++++- example-scripts/gstreamer/source-avsync-test-clip-as-cam1.sh | 5 +++-- .../gstreamer/source-videotestsrc-as-background-loop.sh | 3 ++- example-scripts/gstreamer/source-videotestsrc-as-cam1.sh | 5 +++-- example-scripts/gstreamer/source-videotestsrc-as-cam2.sh | 5 +++-- example-scripts/gstreamer/source-videotestsrc-as-grabber.sh | 5 +++-- 14 files changed, 59 insertions(+), 20 deletions(-) create mode 100644 example-scripts/config.sh diff --git a/example-scripts/config.sh b/example-scripts/config.sh new file mode 100644 index 0000000..f6fb91b --- /dev/null +++ b/example-scripts/config.sh @@ -0,0 +1,5 @@ +#!/bin/sh +WIDTH=1920 +HEIGHT=1080 +FRAMERATE=25 +AUDIORATE=48000 diff --git a/example-scripts/ffmpeg/source-avsync-test-clip-as-cam1.sh b/example-scripts/ffmpeg/source-avsync-test-clip-as-cam1.sh index 5c0f47e..fd55f05 100755 --- a/example-scripts/ffmpeg/source-avsync-test-clip-as-cam1.sh +++ b/example-scripts/ffmpeg/source-avsync-test-clip-as-cam1.sh @@ -1,7 +1,12 @@ #!/bin/sh +. `dirname "$0"`/../config.sh ffmpeg -y \ -i http://c3voc.mazdermind.de/testfiles/avsync.ts \ - -vf scale=1920x1080 \ + -filter_complex " + [0:v] scale=$WIDTH:$HEIGHT,fps=$FRAMERATE [v] ; + [0:a] aresample=$AUDIORATE [a] + " \ + -map "[v]" -map "[a]" \ -c:v rawvideo \ -c:a pcm_s16le \ -pix_fmt yuv420p \ diff --git a/example-scripts/ffmpeg/source-avsync-test-clip-looped-as-cam1.sh b/example-scripts/ffmpeg/source-avsync-test-clip-looped-as-cam1.sh index c454dd7..4de3f83 100755 --- a/example-scripts/ffmpeg/source-avsync-test-clip-looped-as-cam1.sh +++ b/example-scripts/ffmpeg/source-avsync-test-clip-looped-as-cam1.sh @@ -1,8 +1,13 @@ #!/bin/sh +. `dirname "$0"`/../config.sh wget -nc -O /tmp/avsync.ts http://c3voc.mazdermind.de/testfiles/avsync.ts (while true; do cat /tmp/avsync.ts || exit; done) | ffmpeg -y \ -i - \ - -vf scale=1920x1080 \ + -filter_complex " + [0:v] scale=$WIDTH:$HEIGHT,fps=$FRAMERATE [v] ; + [0:a] aresample=$AUDIORATE [a] + " \ + -map "[v]" -map "[a]" \ -c:v rawvideo \ -c:a pcm_s16le \ -pix_fmt yuv420p \ diff --git a/example-scripts/ffmpeg/source-background-loop.sh b/example-scripts/ffmpeg/source-background-loop.sh index 00ff35c..3613862 100755 --- a/example-scripts/ffmpeg/source-background-loop.sh +++ b/example-scripts/ffmpeg/source-background-loop.sh @@ -1,8 +1,12 @@ #!/bin/sh +. `dirname "$0"`/../config.sh wget -nc -O /tmp/bg.ts http://c3voc.mazdermind.de/testfiles/bg.ts while true; do cat /tmp/bg.ts || exit 1; done |\ ffmpeg -re -i - \ - -map 0:v \ + -filter_complex " + [0:v] scale=$WIDTH:$HEIGHT,fps=$FRAMERATE [v] + " \ + -map "[v]" \ -c:v rawvideo \ -pix_fmt yuv420p \ -f matroska \ diff --git a/example-scripts/ffmpeg/source-mjpg-framegrabber.sh b/example-scripts/ffmpeg/source-mjpg-framegrabber.sh index 6b47bf7..c470a91 100755 --- a/example-scripts/ffmpeg/source-mjpg-framegrabber.sh +++ b/example-scripts/ffmpeg/source-mjpg-framegrabber.sh @@ -1,12 +1,12 @@ #!/bin/sh +. `dirname "$0"`/../config.sh ffmpeg -y \ -i "http://10.73.5.2:1881/stream.mjpg" \ -filter_complex " - [0:v] scale=1920:1080,fps=25 [v] ; - anullsrc=r=48000:cl=stereo [a] + [0:v] scale=$WIDTH:$HEIGHT,fps=$FRAMERATE [v] ; + anullsrc=r=$AUDIORATE:cl=stereo [a] " \ - -map "[v]" \ - -map "[a]" \ + -map "[v]" -map "[a]" \ -c:a pcm_s16le \ -c:v rawvideo \ -pix_fmt yuv420p \ diff --git a/example-scripts/ffmpeg/source-nostream-music.sh b/example-scripts/ffmpeg/source-nostream-music.sh index 71bc1ed..9a8c877 100755 --- a/example-scripts/ffmpeg/source-nostream-music.sh +++ b/example-scripts/ffmpeg/source-nostream-music.sh @@ -1,10 +1,11 @@ #!/bin/sh +. `dirname "$0"`/../config.sh wget -nc -O /tmp/machine_lullaby_1.ogg http://c3voc.mazdermind.de/testfiles/machine_lullaby_1.ogg while true; do ffmpeg -y \ -i "/tmp/machine_lullaby_1.ogg" \ -ac 2 \ - -af aresample=48000 \ + -af aresample=$AUDIORATE \ -c:a pcm_s16le \ -f matroska \ tcp://localhost:18000 diff --git a/example-scripts/ffmpeg/source-nostream-pause-loop.sh b/example-scripts/ffmpeg/source-nostream-pause-loop.sh index 65b7436..69ac366 100755 --- a/example-scripts/ffmpeg/source-nostream-pause-loop.sh +++ b/example-scripts/ffmpeg/source-nostream-pause-loop.sh @@ -1,8 +1,12 @@ #!/bin/sh +. `dirname "$0"`/../config.sh wget -nc -O /tmp/pause.ts http://c3voc.mazdermind.de/testfiles/pause.ts while true; do cat /tmp/pause.ts || exit 1; done |\ ffmpeg -re -i - \ - -map 0:v \ + -filter_complex " + [0:v] scale=$WIDTH:$HEIGHT,fps=$FRAMERATE [v] + " \ + -map '[v]' \ -c:v rawvideo \ -pix_fmt yuv420p \ -f matroska \ diff --git a/example-scripts/ffmpeg/source-testvideo-as-cam1.sh b/example-scripts/ffmpeg/source-testvideo-as-cam1.sh index ef73a08..bd68933 100755 --- a/example-scripts/ffmpeg/source-testvideo-as-cam1.sh +++ b/example-scripts/ffmpeg/source-testvideo-as-cam1.sh @@ -1,8 +1,13 @@ #!/bin/sh +. `dirname "$0"`/../config.sh ffmpeg -y \ -i "http://ftp.uni-erlangen.de/cdn.media.ccc.de/broadcast/sendezentrum/h264-hd/31c3-sendezentrum-1013-de-Methodisch_inkorrekt_Die_falsche_42_hd.mp4" \ -ac 2 \ - -af aresample=48000 \ + -filter_complex " + [0:v] scale=$WIDTH:$HEIGHT,fps=$FRAMERATE [v] ; + [0:a] aresample=$AUDIORATE [a] + " \ + -map "[v]" -map "[a]" \ -pix_fmt yuv420p \ -c:v rawvideo \ -c:a pcm_s16le \ diff --git a/example-scripts/ffmpeg/source-testvideo-as-cam2.sh b/example-scripts/ffmpeg/source-testvideo-as-cam2.sh index 7cb795a..1c72485 100755 --- a/example-scripts/ffmpeg/source-testvideo-as-cam2.sh +++ b/example-scripts/ffmpeg/source-testvideo-as-cam2.sh @@ -1,8 +1,13 @@ #!/bin/sh +. `dirname "$0"`/../config.sh ffmpeg -y \ -i "http://ftp.uni-erlangen.de/cdn.media.ccc.de/broadcast/sendezentrum/h264-hd/31c3-sendezentrum-1003-de-Freak_Show_FS147_That_Escalatored_Quickly_hd.mp4" \ -ac 2 \ - -af aresample=48000 \ + -filter_complex " + [0:v] scale=$WIDTH:$HEIGHT,fps=$FRAMERATE [v] ; + [0:a] aresample=$AUDIORATE [a] + " \ + -map "[v]" -map "[a]" \ -pix_fmt yuv420p \ -c:v rawvideo \ -c:a pcm_s16le \ diff --git a/example-scripts/gstreamer/source-avsync-test-clip-as-cam1.sh b/example-scripts/gstreamer/source-avsync-test-clip-as-cam1.sh index 14d9f6c..f100cb0 100755 --- a/example-scripts/gstreamer/source-avsync-test-clip-as-cam1.sh +++ b/example-scripts/gstreamer/source-avsync-test-clip-as-cam1.sh @@ -1,4 +1,5 @@ #!/bin/sh +. `dirname "$0"`/../config.sh gst-launch-1.0 \ uridecodebin \ uri=http://c3voc.mazdermind.de/testfiles/avsync.mp4 \ @@ -8,7 +9,7 @@ gst-launch-1.0 \ queue !\ videoconvert !\ videoscale !\ - video/x-raw,format=I420,width=1920,height=1080,framerate=25/1,pixel-aspect-ratio=1/1 ! \ + video/x-raw,format=I420,width=$WIDTH,height=$HEIGHT,framerate=$FRAMERATE/1,pixel-aspect-ratio=1/1 ! \ mux. \ \ src. !\ @@ -16,7 +17,7 @@ gst-launch-1.0 \ audioconvert !\ audioresample !\ audiorate !\ - audio/x-raw,format=S16LE,channels=2,layout=interleaved,rate=48000 !\ + audio/x-raw,format=S16LE,channels=2,layout=interleaved,rate=$AUDIORATE !\ mux. \ \ matroskamux name=mux !\ diff --git a/example-scripts/gstreamer/source-videotestsrc-as-background-loop.sh b/example-scripts/gstreamer/source-videotestsrc-as-background-loop.sh index a96786a..ea550ef 100755 --- a/example-scripts/gstreamer/source-videotestsrc-as-background-loop.sh +++ b/example-scripts/gstreamer/source-videotestsrc-as-background-loop.sh @@ -1,7 +1,8 @@ #!/bin/sh +. `dirname "$0"`/../config.sh gst-launch-1.0 \ videotestsrc pattern=smpte !\ - video/x-raw,format=I420,width=1920,height=1080,framerate=25/1,pixel-aspect-ratio=1/1 !\ + video/x-raw,format=I420,width=$WIDTH,height=$HEIGHT,framerate=$FRAMERATE/1,pixel-aspect-ratio=1/1 ! \ mux. \ \ matroskamux name=mux !\ diff --git a/example-scripts/gstreamer/source-videotestsrc-as-cam1.sh b/example-scripts/gstreamer/source-videotestsrc-as-cam1.sh index 5026260..d43709e 100755 --- a/example-scripts/gstreamer/source-videotestsrc-as-cam1.sh +++ b/example-scripts/gstreamer/source-videotestsrc-as-cam1.sh @@ -1,11 +1,12 @@ #!/bin/sh +. `dirname "$0"`/../config.sh gst-launch-1.0 \ videotestsrc pattern=ball foreground-color=0x00ff0000 background-color=0x00440000 !\ - video/x-raw,format=I420,width=1920,height=1080,framerate=25/1,pixel-aspect-ratio=1/1 !\ + video/x-raw,format=I420,width=$WIDTH,height=$HEIGHT,framerate=$FRAMERATE/1,pixel-aspect-ratio=1/1 ! \ mux. \ \ audiotestsrc freq=440 !\ - audio/x-raw,format=S16LE,channels=2,layout=interleaved,rate=48000 !\ + audio/x-raw,format=S16LE,channels=2,layout=interleaved,rate=$AUDIORATE !\ mux. \ \ matroskamux name=mux !\ diff --git a/example-scripts/gstreamer/source-videotestsrc-as-cam2.sh b/example-scripts/gstreamer/source-videotestsrc-as-cam2.sh index 4e723b4..2d39d9f 100755 --- a/example-scripts/gstreamer/source-videotestsrc-as-cam2.sh +++ b/example-scripts/gstreamer/source-videotestsrc-as-cam2.sh @@ -1,11 +1,12 @@ #!/bin/sh +. `dirname "$0"`/../config.sh gst-launch-1.0 \ videotestsrc pattern=ball foreground-color=0x0000ff00 background-color=0x00004400 !\ - video/x-raw,format=I420,width=1920,height=1080,framerate=25/1,pixel-aspect-ratio=1/1 !\ + video/x-raw,format=I420,width=$WIDTH,height=$HEIGHT,framerate=$FRAMERATE/1,pixel-aspect-ratio=1/1 ! \ mux. \ \ audiotestsrc freq=550 !\ - audio/x-raw,format=S16LE,channels=2,layout=interleaved,rate=48000 !\ + audio/x-raw,format=S16LE,channels=2,layout=interleaved,rate=$AUDIORATE !\ mux. \ \ matroskamux name=mux !\ diff --git a/example-scripts/gstreamer/source-videotestsrc-as-grabber.sh b/example-scripts/gstreamer/source-videotestsrc-as-grabber.sh index 67a6c65..b5cd84c 100755 --- a/example-scripts/gstreamer/source-videotestsrc-as-grabber.sh +++ b/example-scripts/gstreamer/source-videotestsrc-as-grabber.sh @@ -1,11 +1,12 @@ #!/bin/sh +. `dirname "$0"`/../config.sh gst-launch-1.0 \ videotestsrc pattern=snow !\ - video/x-raw,format=I420,width=1920,height=1080,framerate=25/1,pixel-aspect-ratio=1/1 !\ + video/x-raw,format=I420,width=$WIDTH,height=$HEIGHT,framerate=$FRAMERATE/1,pixel-aspect-ratio=1/1 ! \ mux. \ \ audiotestsrc !\ - audio/x-raw,format=S16LE,channels=2,layout=interleaved,rate=48000 !\ + audio/x-raw,format=S16LE,channels=2,layout=interleaved,rate=$AUDIORATE !\ mux. \ \ matroskamux name=mux !\ -- cgit v1.2.3