Git Product home page Git Product logo

theora's Introduction

Xiph.org Foundation's libtheora

What is Theora?

Theora was Xiph.Org's first publicly released video codec, intended for use within the Foundation's Ogg multimedia streaming system. Theora is derived directly from On2's VP3 codec, adds new features while allowing it a longer useful lifetime.

The 1.0 release decoder supported all the new features, but the encoder is nearly identical to the VP3 code.

The 1.1 release featured a completely rewritten encoder, offering better performance and compression, and making more complete use of the format's feature set.

The 1.2 release features significant additional improvements in compression and performance. Files produced by newer encoders can be decoded by earlier releases.

Where is Theora?

Theora's main site is https://www.theora.org. Releases of Theora and related libraries can be found on the download page or the main Xiph.Org site.

Development source is kept at https://gitlab.xiph.org/xiph/theora.

Getting started with the code

What do I need to build the source?

Requirements summary:

For libtheora:

  • libogg 1.1 or newer.

For example encoder:

  • as above,
  • libvorbis and libvorbisenc 1.0.1 or newer. (libvorbis 1.3.1 or newer for 5.1 audio)

For creating a source distribution package:

  • as above,
  • Doxygen to build the API documentation,
  • pdflatex and fig2dev to build the format specification (transfig package in Ubuntu).

For the player only:

  • as above,
  • SDL (Simple Direct media Layer) libraries and headers,
  • OSS audio driver and development headers.

The provided build system is the GNU automake/autoconf system, and the main library, libtheora, should already build smoothly on any system. Failure of libtheora to build on a GNU-enabled system is considered a bug; please report problems to [email protected].

Windows build support is included in the win32 directory.

Project files for Apple XCode are included in the macosx directory.

There is also a more limited scons build.

How do I use the sample encoder?

The sample encoder takes raw video in YUV4MPEG2 format, as used by lavtools, mjpeg-tools and other packages. The encoder expects audio, if any, in a separate wave WAV file. Try 'encoder_example -h' for a complete list of options.

An easy way to get raw video and audio files is to use MPlayer as an export utility. The options " -ao pcm -vo yuv4mpeg " will export a wav file named audiodump.wav and a YUV video file in the correct format for encoder_example as stream.yuv. Be careful when exporting video alone; MPlayer may drop frames to 'keep up' with the audio timer. The example encoder can't properly synchronize input audio and video file that aren't in sync to begin with.

The encoder will also take video or audio on stdin if '-' is specified as the input file name.

There is also a 'png2theora' example which accepts a set of image files in that format.

How do I use the sample player?

The sample player takes an Ogg file on standard in; the file may be audio alone, video alone or video with audio.

What other tools are available?

The programs in the examples directory are intended as tutorial source for developers using the library. As such they sacrifice features and robustness in the interests of comprehension and should not be considered serious applications.

If you're wanting to just use theora, consider the programs linked from https://www.theora.org/. There is playback support in a number of common free players, and plugins for major media frameworks. Jan Gerber's ffmpeg2theora is an excellent encoding front end.

Troubleshooting the build process

Compile error, such as:

encoder_internal.h:664: parse error before ogg_uint16_t

This means you have version of libogg prior to 1.1. A complete new Ogg install, libs and headers is needed.

Also be sure that there aren't multiple copies of Ogg installed in /usr and /usr/local; an older one might be first on the search path for libs and headers.

Link error, such as:

undefined reference to oggpackB_stream

See above; you need libogg 1.1 or later.

Link error, such as:

undefined reference to vorbis_granule_time

You need libvorbis and libvorbisenc from the 1.0.1 release or later.

Link error, such as:

/usr/lib/libSDL.a(SDL_esdaudio.lo): In function ESD_OpenAudio: SDL_esdaudio.lo(.text+0x25d): undefined reference to esd_play_stream

Be sure to use an SDL that's built to work with OSS. If you use an SDL that is also built with ESD and/or ALSA support, it will try to suck in all those extra libraries at link time too. That will only work if the extra libraries are also installed.

Link warning, such as:

libtool: link: warning: library /usr/lib/libogg.la was moved. libtool: link: warning: library /usr/lib/libogg.la was moved.

Re-run theora/autogen.sh after an Ogg or Vorbis rebuild/reinstall

theora's People

Contributors

agx avatar ccawley2011 avatar dschleef avatar gmaxwell avatar jhasse avatar lacostej avatar rillian avatar tmatth avatar uniqp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

theora's Issues

Building with emscripten leads to "OC_FZIG_ZAG: symbol multiply defined" error

I am trying to build ffmpeg (with theora encoding support) using emscripten but am running into the following error (from ffmpeg config.log file):

require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
check_lib libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
check_func_headers theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
test_ld cc -ltheoraenc -ltheoradec -logg
test_cc
BEGIN /tmp/ffconf.P64tf3xZ/test.c
    1   #include <theora/theoraenc.h>
    2   #include <stdint.h>
    3   long check_th_info_init(void) { return (long) th_info_init; }
    4   int main(void) { int ret = 0;
    5    ret |= ((intptr_t)check_th_info_init) & 0xFFFF;
    6   return ret; }
END /tmp/ffconf.P64tf3xZ/test.c
emcc -I/root/ffmpeg-wasm/lib/ogg/dist/include -I/root/ffmpeg-wasm/lib/vorbis/dist/include -I/root/ffmpeg-wasm/lib/theora/dist/include -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -std=c11 -fomit-frame-pointer -c -o /tmp/ffconf.P64tf3xZ/test.o /tmp/ffconf.P64tf3xZ/test.c
emcc -L/root/ffmpeg-wasm/lib/ogg/dist/lib -L/root/ffmpeg-wasm/lib/vorbis/dist/lib -L/root/ffmpeg-wasm/lib/theora/dist/lib -Wl,--as-needed -Wl,-z,noexecstack -o /tmp/ffconf.P64tf3xZ/test /tmp/ffconf.P64tf3xZ/test.o -ltheoraenc -ltheoradec -logg
error: Linking globals named 'OC_FZIG_ZAG': symbol multiply defined!
shared:ERROR: Failed to run llvm optimizations:
ERROR: libtheora not found

which appears to be related to libtheoraenc.so and libtheoradec.so both containing OC_FZIG_ZAG:

> llvm-nm libtheoraenc.so | grep "OC_FZIG_ZAG"
-------- D OC_FZIG_ZAG
> llvm-nm libtheoradec.so | grep "OC_FZIG_ZAG"
-------- D OC_FZIG_ZAG

Building theora with --disable-encode fixes the issue but then ffmpeg is unable to encode using theora.
Any pointers would be appreciated. I have successfully built ffmpeg using emscripten in the past with different libs, but I can't seem to figure out theora.

undefined shifts

FFmpeg / Google ossfuzz did run into 2 bad shifts while encoding with libtheora through FFmpeg.

The first likely should be *8 instead of <<3, theres are 13 more matches to stride<< i dont know if these can be negative too

The 2nd case shifts into the sign bit which is undefined. It likely was meant to be unsigned

The stack traces from UndefinedBehaviorSanitizer are below

	state.c:654:19: runtime error: left shift of negative value -96
    #0 0x87b6f0 in oc_state_ref_bufs_init theora/lib/state.c:654:19
    #1 0x879e0c in oc_state_init theora/lib/state.c:736:17
    #2 0x85dc43 in oc_enc_init theora/lib/encode.c:1159:7
    #3 0x85dc43 in th_encode_alloc theora/lib/encode.c:1346:17
    #4 0x409499 in encode_init /src/ffmpeg/libavcodec/libtheoraenc.c:231:18
    #5 0x4d27ab in avcodec_open2 /src/ffmpeg/libavcodec/avcodec.c:326:19
    #6 0x4d11b5 in LLVMFuzzerTestOneInput /src/ffmpeg/tools/target_enc_fuzzer.c:153:15
    #7 0x436ab3 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:611:15
    #8 0x422212 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:324:6
    #9 0x427abc in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:860:9
    #10 0x450ff2 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
    #11 0x79fee856e082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/libc-start.c:308:16
    #12 0x4183dd in _start
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior state.c:654:19 in
	state.c:399:37: runtime error: left shift of 1 by 63 places cannot be represented in type 'ogg_int64_t' (aka 'long')
    #0 0x87ebd8 in oc_state_border_init theora/lib/state.c:399:37
    #1 0x87a9c4 in oc_state_frarray_init theora/lib/state.c:524:3
    #2 0x879de9 in oc_state_init theora/lib/state.c:735:7
    #3 0x85dc43 in oc_enc_init theora/lib/encode.c:1159:7
    #4 0x85dc43 in th_encode_alloc theora/lib/encode.c:1346:17
    #5 0x409499 in encode_init /src/ffmpeg/libavcodec/libtheoraenc.c:231:18
    #6 0x4d27ab in avcodec_open2 /src/ffmpeg/libavcodec/avcodec.c:326:19
    #7 0x4d11b5 in LLVMFuzzerTestOneInput /src/ffmpeg/tools/target_enc_fuzzer.c:153:15
    #8 0x436ab3 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:611:15
    #9 0x422212 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:324:6
    #10 0x427abc in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:860:9
    #11 0x450ff2 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
    #12 0x7b6e9cb8d082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/libc-start.c:308:16
    #13 0x4183dd in _start
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior state.c:399:37 in

CMake build

Hi, I see a cmake build option for both ogg and vorbis, but not this great theora library. It would be great to be able to request one.

New stable release

Some projects are removing Theora support for some reasons, including the fact the last official release was too many years ago, and also missing some important fixes (ome references below). Linux distros also needs to include many patches to build on recent environments: https://salsa.debian.org/multimedia-team/libtheora/-/tree/master/debian/patches

Is there a plan to have a new release with the accumulated fixes? A new release with the Ptalarbvorm would be even better. ๐Ÿ’ฏ


DaemonEngine: DaemonEngine/Daemon#391

I noticed the Theora project seems kind of dead. When compiling, I saw a gcc warning that the decoder code indexes out of bounds. Although this was fixed in 2012, there hasn't been a new release since 2010 so we didn't have the fix.

Google Chrome: https://chromestatus.com/feature/5158654475239424

The Theora video codec was first released in 2004 and had its last official release in 2011.

Mozilla Firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=1860492

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.