Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/env bash
# summary of my testing for: https://www.raspberrypi.org/forums/viewtopic.php?f=67&t=309723
sudo apt update
sudo apt install gstreamer1.0-tools gstreamer1.0-plugins-base-apps gstreamer1.0-plugins-good gstreamer1.0-plugins-bad
gst-launch-1.0 --version
# gst-launch-1.0 version 1.14.4
# GStreamer 1.14.4
# http://packages.qa.debian.org/gstreamer1.0
#
# todo: maybe using a more up-to-date gstreamer version would help. Latest versionis 1.19.
# I tried for an hour or so to build gstreamer + plugins from source on the raspberry pi but it was difficult
# and I failed.
# download 1080p version
youtube-dl https://www.youtube.com/watch\?v\=ucZl6vQ_8Uo -f 'bestvideo[vcodec^=avc1][height=1080]+bestaudio' -o sync_test_1080p.mp4
# convert to mov, doubt that would help, but that was in 6by9's example:
# https://www.raspberrypi.org/forums/viewtopic.php?f=67&t=240274#p1467301
ffmpeg -i sync_test_1080p.mp4 -f mov sync_test_1080p.mov
# download 720p version
youtube-dl https://www.youtube.com/watch\?v\=ucZl6vQ_8Uo -f 'bestvideo[vcodec^=avc1][height=720]+bestaudio' -o sync_test_720p.mp4
ffmpeg -i sync_test_720p.mp4 -f mov sync_test_720p.mov
ffprobe sync_test_1080p.mp4
# Duration: 00:01:03.09, start: 0.000000, bitrate: 431 kb/s
# Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 295 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
ffprobe sync_test_1080p.mov
# Duration: 00:01:03.11, start: 0.000000, bitrate: 428 kb/s
# Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 359 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
ffprobe sync_test_720p.mp4
# Duration: 00:01:03.09, start: 0.000000, bitrate: 344 kb/s
# Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 208 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
ffprobe sync_test_720p.mov
# Duration: 00:01:03.11, start: 0.000000, bitrate: 320 kb/s
# Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 251 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
# test cases. All of these exhibited some lag / choppiness / glitches
for file in sync_test_1080p.mp4 sync_test_1080p.mov sync_test_720p.mp4 sync_test_720p.mov
do
echo "running gst-launch-1.0 on $file ..."
gst-launch-1.0 -e -vvv filesrc location=$file ! qtdemux ! h264parse ! v4l2h264dec ! kmssink
gst-launch-1.0 -e -vvv filesrc location=$file ! qtdemux ! queue ! h264parse ! v4l2h264dec ! kmssink
gst-launch-1.0 -e -vvv filesrc location=$file ! qtdemux ! queue ! h264parse ! v4l2h264dec ! queue ! kmssink
gst-launch-1.0 -e filesrc location=$file ! qtdemux ! h264parse ! v4l2h264dec capture-io-mode=4 ! kmssink
gst-launch-1.0 -e filesrc location=$file ! qtdemux ! queue ! h264parse ! v4l2h264dec capture-io-mode=4 ! kmssink
gst-launch-1.0 -e filesrc location=$file ! qtdemux ! queue ! h264parse ! v4l2h264dec capture-io-mode=4 ! queue ! kmssink
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment