Skip to content

Instantly share code, notes, and snippets.

Live Transcoding

This is a collection of working commandline examples to show how one could use FFMpeg and VLC for live transcoding of video streams. All examples have been tested on OSX 10.7.5 with FFMPeg 1.1.3 and VLC 2.0.5 in early 2013.

Documentation links

@tigerwood
tigerwood / save_packet_to_disk
Created June 6, 2017 06:19 — forked from sunjun/save_packet_to_disk
save AVPacket from mem to disk and then read back
#include <libavutil/timestamp.h>
#include <libavformat/avformat.h>
static FILE *open_file_write(const char *file);
static FILE *open_file_read(const char *file);
static size_t write_packt_to_file(AVPacket *packet, FILE *file);
static size_t read_packt_from_file(AVPacket *packet, FILE *file);
static void close_file(FILE *file);
static void log_packet(const AVFormatContext *fmt_ctx, const AVPacket *pkt, const char *tag)
@tigerwood
tigerwood / save_frame_as_jpeg.c
Created May 30, 2017 03:44
Save an AVFrame as a JPEG file using FFmpeg
int save_frame_as_jpeg(AVCodecContext *pCodecCtx, AVFrame *pFrame, int FrameNo) {
AVCodec *jpegCodec = avcodec_find_encoder(AV_CODEC_ID_JPEG2000);
if (!jpegCodec) {
return -1;
}
AVCodecContext *jpegContext = avcodec_alloc_context3(jpegCodec);
if (!jpegContext) {
return -1;
}