filmstro_ffmpeg
 All Classes Files Functions Friends Macros
Public Member Functions | Static Public Member Functions | List of all members
FFmpegVideoWriter Class Reference

#include <filmstro_ffmpeg_FFmpegVideoWriter.h>

Inheritance diagram for FFmpegVideoWriter:
FFmpegVideoListener

Public Member Functions

 FFmpegVideoWriter (const juce::String &format=juce::String())
 
 ~FFmpegVideoWriter ()
 
void setVideoCodec (AVCodecID codec=AV_CODEC_ID_PROBE)
 Set the requested video codec before opening a file. More...
 
void setAudioCodec (AVCodecID codec=AV_CODEC_ID_PROBE)
 Set the requested audio codec before opening a file. More...
 
void setSubtitleCodec (AVCodecID codec=AV_CODEC_ID_PROBE)
 Set the requested subtitle codec before opening a file. More...
 
void setSampleRate (const int newSampleRate)
 Set the audio sample rate before opening a file. More...
 
void setVideoSize (const int width, const int height)
 Set the video size before opening a file. More...
 
void setPixelFormat (const AVPixelFormat format)
 Set the pixel format before opening a file. More...
 
void setPixelAspect (const int num, const int den)
 Set the pixel aspect ratio as fraction before opening a file. More...
 
void setTimeBase (AVMediaType type, AVRational timebase)
 Set the timebase for the stream, provide either AVMEDIA_TYPE_VIDEO, AVMEDIA_TYPE_AUDIO, AVMEDIA_TYPE_SUBTITLE. More...
 
void copySettingsFromContext (const AVCodecContext *context)
 copies settings from a context (e.g. More...
 
bool openMovieFile (const juce::File &outputFile, const juce::String &format=juce::String())
 Opens a file for writing audio, video and subtitles. More...
 
void closeMovieFile ()
 Closes the movie file. More...
 
void writeNextAudioBlock (juce::AudioSourceChannelInfo &info)
 Append a chunk of audio data. More...
 
void writeNextVideoFrame (const juce::Image &image, const juce::int64 timestamp)
 Write the next video frame from juce image. More...
 
void videoSizeChanged (const int width, const int height, const AVPixelFormat) override
 This is called whenever the size changed, so a framebuffer can be resized. More...
 
void displayNewFrame (const AVFrame *) override
 This callback receives frames from e.g. More...
 
- Public Member Functions inherited from FFmpegVideoListener
 FFmpegVideoListener ()
 
virtual ~FFmpegVideoListener ()
 
virtual void presentationTimestampChanged (const double)
 This will notify about advancing the presentation timestamp. More...
 
virtual void readRawFrame (const AVFrame *)
 This is called when a frame is read from the video stream. More...
 
virtual void videoFileChanged (const juce::File &newSource)
 This is called when the video source file has changed. More...
 

Static Public Member Functions

static juce::StringArray getOutputFormatNames ()
 Returns the names of available output formats. More...
 

Constructor & Destructor Documentation

FFmpegVideoWriter::FFmpegVideoWriter ( const juce::String &  format = juce::String())
FFmpegVideoWriter::~FFmpegVideoWriter ( )

Member Function Documentation

void FFmpegVideoWriter::closeMovieFile ( )

Closes the movie file.

Also flushes all left over samples and frames

void FFmpegVideoWriter::copySettingsFromContext ( const AVCodecContext *  context)

copies settings from a context (e.g.

FFmpegVideoReader) to the writer

void FFmpegVideoWriter::displayNewFrame ( const AVFrame *  frame)
overridevirtual

This callback receives frames from e.g.

the FFmpegVideoReader to be written to the video file. The timestamp has to be set in the frame.

Reimplemented from FFmpegVideoListener.

juce::StringArray FFmpegVideoWriter::getOutputFormatNames ( )
static

Returns the names of available output formats.

bool FFmpegVideoWriter::openMovieFile ( const juce::File &  outputFile,
const juce::String &  format = juce::String() 
)

Opens a file for writing audio, video and subtitles.

The settings like encoders, samplerate etc. has to be set first.

void FFmpegVideoWriter::setAudioCodec ( AVCodecID  codec = AV_CODEC_ID_PROBE)

Set the requested audio codec before opening a file.

void FFmpegVideoWriter::setPixelAspect ( const int  num,
const int  den 
)

Set the pixel aspect ratio as fraction before opening a file.

void FFmpegVideoWriter::setPixelFormat ( const AVPixelFormat  format)

Set the pixel format before opening a file.

void FFmpegVideoWriter::setSampleRate ( const int  newSampleRate)

Set the audio sample rate before opening a file.

void FFmpegVideoWriter::setSubtitleCodec ( AVCodecID  codec = AV_CODEC_ID_PROBE)

Set the requested subtitle codec before opening a file.

void FFmpegVideoWriter::setTimeBase ( AVMediaType  type,
AVRational  timebase 
)

Set the timebase for the stream, provide either AVMEDIA_TYPE_VIDEO, AVMEDIA_TYPE_AUDIO, AVMEDIA_TYPE_SUBTITLE.

void FFmpegVideoWriter::setVideoCodec ( AVCodecID  codec = AV_CODEC_ID_PROBE)

Set the requested video codec before opening a file.

void FFmpegVideoWriter::setVideoSize ( const int  width,
const int  height 
)

Set the video size before opening a file.

void FFmpegVideoWriter::videoSizeChanged ( const int  width,
const int  height,
const AVPixelFormat   
)
overridevirtual

This is called whenever the size changed, so a framebuffer can be resized.

Reimplemented from FFmpegVideoListener.

void FFmpegVideoWriter::writeNextAudioBlock ( juce::AudioSourceChannelInfo &  info)

Append a chunk of audio data.

It will call writeAudioFrame to get rid of the data

void FFmpegVideoWriter::writeNextVideoFrame ( const juce::Image &  image,
const juce::int64  timestamp 
)

Write the next video frame from juce image.


The documentation for this class was generated from the following files: