From 61ab2119260aa15e87ae72f9f766019ae789d6d0 Mon Sep 17 00:00:00 2001 From: Petter Reinholdtsen <pere@debian.org> Date: Sun, 16 Mar 2025 09:37:50 +0100 Subject: [PATCH] Added example wrapper script encoder_example_ffmpeg. Based on script posted to https://bugs.debian.org/516343 in 2009 by Robert Millan. Fixes #1601 --- examples/Makefile.am | 1 + examples/encoder_example_ffmpeg | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100755 examples/encoder_example_ffmpeg diff --git a/examples/Makefile.am b/examples/Makefile.am index 40c72f06..999b0d90 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -5,6 +5,7 @@ noinst_PROGRAMS = dump_video dump_psnr libtheora_info \ # possible contents of BUILDABLE_EXAMPLES: EXTRA_PROGRAMS = player_example encoder_example png2theora tiff2theora +EXTRA_DIST = encoder_example_ffmpeg AM_CPPFLAGS = -I$(top_srcdir)/include AM_CFLAGS = $(OGG_CFLAGS) diff --git a/examples/encoder_example_ffmpeg b/examples/encoder_example_ffmpeg new file mode 100755 index 00000000..424df787 --- /dev/null +++ b/examples/encoder_example_ffmpeg @@ -0,0 +1,29 @@ +#!/bin/sh +#################################################################### +# # +# THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE. # +# USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS # +# GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE # +# IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. # +# # +# THE Theora SOURCE CODE IS COPYRIGHT (C) 2009,2025 # +# by the Xiph.Org Foundation and contributors http://www.xiph.org/ # +# # +#################################################################### + +set -x + +video=`mktemp` +audio=`mktemp` + +rm -f $video $audio +mkfifo $video $audio + +# A single process can handle both, but this results in deadlock because +# mplayer is single-threaded. +mplayer "$1" -ao null -vo yuv4mpeg:file=$video > /dev/null 2>&1 & +mplayer "$1" -vo null -ao pcm:file=$audio > /dev/null 2>&1 & + +theora_encoder_example $video $audio > "$2".new && mv "$2".new $2 + +rm -f $video $audio -- GitLab