22 #include "libavutil/intreadwrite.h"
23 #include "libavutil/dict.h"
24 #include "libavutil/intfloat.h"
25 #include "libavutil/avassert.h"
82 "FLV only supports wideband (16kHz) Speex audio\n");
110 "FLV does not support sample rate %d, "
111 "choose from (44100, 22050, 11025)\n", enc->
sample_rate);
163 size_t len = strlen(str);
173 avio_w8(pb, (ts >> 24) & 0x7F);
197 AVCodecContext *audio_enc = NULL, *video_enc = NULL, *data_enc = NULL;
198 int i, metadata_count = 0;
199 double framerate = 0.0;
200 int64_t metadata_size_pos, data_size, metadata_count_pos;
216 "at most one video stream is supported in flv\n");
221 av_log(s,
AV_LOG_ERROR,
"Video codec '%s' for stream %d is not compatible with FLV\n",
229 "at most one audio stream is supported in flv\n");
293 metadata_count = 5 * !!video_enc +
346 if( !strcmp(tag->
key,
"width")
347 ||!strcmp(tag->
key,
"height")
348 ||!strcmp(tag->
key,
"videodatarate")
349 ||!strcmp(tag->
key,
"framerate")
350 ||!strcmp(tag->
key,
"videocodecid")
351 ||!strcmp(tag->
key,
"audiodatarate")
352 ||!strcmp(tag->
key,
"audiosamplerate")
353 ||!strcmp(tag->
key,
"audiosamplesize")
354 ||!strcmp(tag->
key,
"stereo")
355 ||!strcmp(tag->
key,
"audiocodecid")
356 ||!strcmp(tag->
key,
"duration")
357 ||!strcmp(tag->
key,
"onMetaData")
376 data_size =
avio_tell(pb) - metadata_size_pos - 10;
378 avio_seek(pb, metadata_count_pos, SEEK_SET);
381 avio_seek(pb, metadata_size_pos, SEEK_SET);
408 avio_seek(pb, -data_size - 10, SEEK_CUR);
477 "Video codec '%s' is not compatible with FLV\n",
507 "use audio bitstream filter 'aac_adtstoasc' to fix it "
508 "('-bsf:a aac_adtstoasc' option with ffmpeg)\n");
519 "Packets are not in the proper order with respect to DTS\n");
528 "8 frames per packet. Adobe Flash "
529 "Player cannot handle this!\n");
536 avio_w8(pb, (ts >> 24) & 0x7F);
555 data_size =
avio_tell(pb) - metadata_size_pos;
556 avio_seek(pb, metadata_size_pos - 10, SEEK_SET);
558 avio_seek(pb, data_size + 10 - 3, SEEK_CUR);
591 .mime_type =
"video/x-flv",
#define CONFIG_LIBMP3LAME
int64_t delay
first dts delay (needed for AVC & Speex)
#define AV_LOG_WARNING
Something somehow does not look correct.
AVDictionaryEntry * av_dict_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
AVCodecContext * codec
Codec context associated with this stream.
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
static double av_q2d(AVRational a)
Convert rational to double.
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
int duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
void * priv_data
Format private data.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
preferred ID for decoding MPEG audio layer 1, 2 or 3
const char * avcodec_get_name(enum AVCodecID id)
Get the name of a codec.
AVRational avg_frame_rate
Average framerate.
int ff_avc_parse_nal_units_buf(const uint8_t *buf_in, uint8_t **buf, int *size)
int flags
A combination of AV_PKT_FLAG values.
const char * av_get_media_type_string(enum AVMediaType media_type)
Return a string describing the media_type enum, NULL if media_type is unknown.
unsigned int nb_streams
A list of all streams in the file.
int bit_rate
the average bitrate
Opaque data information usually continuous.
#define AV_TIME_BASE
Internal time base represented as integer.
int width
picture width / height.
static int write_trailer(AVFormatContext *s1)
enum AVMediaType codec_type
int sample_rate
samples per second
main external API structure.
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
AVIOContext * pb
I/O context.
int error
contains the error code or 0 if no error happened
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
int64_t nb_frames
number of frames in this stream if known or 0
#define AVERROR_INVALIDDATA
int channels
number of audio channels
static void write_header(FFV1Context *f)
static av_always_inline uint64_t av_double2int(double f)
Reinterpret a double as a 64-bit integer.
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
int64_t duration
Decoding: duration of the stream, in AV_TIME_BASE fractional seconds.
#define AV_DICT_IGNORE_SUFFIX
#define av_assert0(cond)
assert() equivalent, that is always enabled.
This structure stores compressed data.
static int write_packet(AVFormatContext *s1, AVPacket *pkt)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
int64_t last_ts
last timestamp for each stream
int ff_isom_write_avcc(AVIOContext *pb, const uint8_t *data, int len)
#define AV_NOPTS_VALUE
Undefined timestamp value.
void * av_mallocz(size_t size) av_malloc_attrib 1(1)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...