Skip to content

foodsnacker/pb_play_mpeg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pb_play_mpeg v 0.1

by Jörg Burbach, homepage

license: MIT

This is a wrapper around the one-file mpeg-1-decoder pl_mpeg.h. This source also demonstrates how to (not elegantly) play a file in an imagegadget. However, audio is missing at the moment. Have to figure that out.

based on pl_mpeg.h by Dominic Szablewski, Repository on Github this code uses Big Buck Bunny by Blender Foundation, which I converted to MPEG1 Big Buck Bunny

functions

  • load from disk
  • check for mpeg-file
  • decode video and audio frames on demand
  • get information about the video
  • enable or disable video or audio
  • audio is always stereo-interleaved!

todo

  • improve and optimize the code
  • play audio as a test case
  • use a precision timer for playback
    • like: decode frame, wait For the timer, display And already decode the Next frame
  • make a Github-repo and upload it
  • play file from memory

How-To:

macOS:

  1. pull the source for pl_mpeg.h from Repository on Github

  2. write a small snippet to pl_mpeg.c

#ifdef __cplusplus
extern "C" {
#endif

#define PL_MPEG_IMPLEMENTATION
#include "pl_mpeg.h"

#ifdef __cplusplus
}
#endif
  1. use the terminal.app with these commands
	gcc -c -arch arm64 pl_mpeg.c -o pl_mpeg.o
	ar rcs libplmpeg.a pl_mpeg.o
  1. put the resulting libplmpeg.a where you have your PureBasic-code

  2. check the example!

5b. If you need to convert your movie, use ffmpeg

ffmpeg -i movie.mp4 -c:v mpeg1video -b:v 500k -c:a mp2 -b:a 64k -s 320x240 -t 30 output.mpg 
  1. You can download sample-videos from https://filesamples.com/formats/mpeg

  2. enjoy

About

Wrapper for pl_mpeg.h in PureBasic

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published