94 "FLV only supports wideband (16kHz) Speex audio\n");
122 "FLV does not support sample rate %d, "
123 "choose from (44100, 22050, 11025)\n", enc->
sample_rate);
175 size_t len = strlen(str);
185 avio_w8(pb, (ts >> 24) & 0x7F);
209 int metadata_count = 0;
210 int64_t metadata_size_pos, data_size, metadata_count_pos;
285 if( !strcmp(tag->
key,
"width")
286 ||!strcmp(tag->
key,
"height")
287 ||!strcmp(tag->
key,
"videodatarate")
288 ||!strcmp(tag->
key,
"framerate")
289 ||!strcmp(tag->
key,
"videocodecid")
290 ||!strcmp(tag->
key,
"audiodatarate")
291 ||!strcmp(tag->
key,
"audiosamplerate")
292 ||!strcmp(tag->
key,
"audiosamplesize")
293 ||!strcmp(tag->
key,
"stereo")
294 ||!strcmp(tag->
key,
"audiocodecid")
295 ||!strcmp(tag->
key,
"duration")
296 ||!strcmp(tag->
key,
"onMetaData")
297 ||!strcmp(tag->
key,
"datasize")
298 ||!strcmp(tag->
key,
"lasttimestamp")
299 ||!strcmp(tag->
key,
"totalframes")
300 ||!strcmp(tag->
key,
"hasAudio")
301 ||!strcmp(tag->
key,
"hasVideo")
302 ||!strcmp(tag->
key,
"hasCuePoints")
303 ||!strcmp(tag->
key,
"hasMetadata")
304 ||!strcmp(tag->
key,
"hasKeyframes")
323 data_size =
avio_tell(pb) - metadata_size_pos - 10;
325 avio_seek(pb, metadata_count_pos, SEEK_SET);
328 avio_seek(pb, metadata_size_pos, SEEK_SET);
339 "%s codec %s not compatible with flv\n",
341 desc ? desc->
name :
"unknown");
363 "at most one video stream is supported in flv\n");
378 "use vstrict=-1 / -strict -1 to use it anyway.\n");
383 "Muxing VP6 in flv will produce flipped video on playback.\n");
389 "at most one audio stream is supported in flv\n");
397 "16-bit big-endian audio in flv is valid but most likely unplayable (hardware dependent); use s16le\n");
406 av_log(s,
AV_LOG_ERROR,
"Subtitle codec '%s' for stream %d is not compatible with FLV\n",
464 int samplerate_index;
468 for (samplerate_index = 0; samplerate_index < 16; samplerate_index++)
474 put_bits(&pbc, 4, samplerate_index);
494 avio_seek(pb, -data_size - 10, SEEK_CUR);
546 int flags = -1, flags_size, ret;
561 "Packets are not in the proper order with respect to DTS\n");
604 "use the audio bitstream filter 'aac_adtstoasc' to fix it "
605 "('-bsf:a aac_adtstoasc' option with ffmpeg)\n");
614 "8 frames per packet. Adobe Flash "
615 "Player cannot handle this!\n");
620 if (size + flags_size >= 1<<24) {
622 size + flags_size, 1<<24);
628 avio_w8(pb, (ts >> 24) & 0x7F);
634 int64_t metadata_size_pos =
avio_tell(pb);
654 data_size =
avio_tell(pb) - metadata_size_pos;
655 avio_seek(pb, metadata_size_pos - 10, SEEK_SET);
657 avio_seek(pb, data_size + 10 - 3, SEEK_CUR);
690 {
"flvflags",
"FLV muxer flags", offsetof(
FLVContext,
flags),
AV_OPT_TYPE_FLAGS, {.i64 = 0}, INT_MIN, INT_MAX,
AV_OPT_FLAG_ENCODING_PARAM,
"flvflags" },
705 .mime_type =
"video/x-flv",
void avio_wb64(AVIOContext *s, uint64_t val)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
ptrdiff_t const GLvoid * data
int64_t delay
first dts delay (needed for AVC & Speex)
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
#define AV_LOG_WARNING
Something somehow does not look correct.
int64_t bit_rate
the average bitrate
#define LIBAVUTIL_VERSION_INT
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
static av_always_inline uint64_t av_double2int(double f)
Reinterpret a double as a 64-bit integer.
int event_flags
Flags for the user to detect events happening on the file.
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL AV_RB16
int strict_std_compliance
Allow non-standard and experimental extension.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Opaque data information usually continuous.
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
AVStream ** streams
A list of all streams in the file.
static double av_q2d(AVRational a)
Convert rational to double.
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
#define AV_OPT_FLAG_ENCODING_PARAM
a generic parameter which can be set by the user for muxing or encoding
#define FF_COMPLIANCE_UNOFFICIAL
Allow unofficial extensions.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
AVDictionary * metadata
Metadata that applies to the whole file.
#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
static const int mpeg4audio_sample_rates[16]
simple assert() macros that are a bit more flexible than ISO C assert().
AVCodecContext * data_enc
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 AVCodecDescriptor * avcodec_descriptor_get(enum AVCodecID id)
AVCodecContext * codec
Codec context associated with this stream.
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
#define AV_TIME_BASE
Internal time base represented as integer.
int width
picture width / height.
static int write_trailer(AVFormatContext *s1)
void avio_wb24(AVIOContext *s, unsigned int val)
const char * avcodec_get_name(enum AVCodecID id)
Get the name of a codec.
enum AVMediaType codec_type
int sample_rate
samples per second
AVIOContext * pb
I/O context.
void avio_w8(AVIOContext *s, int b)
main external API structure.
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
Describe the class of an AVClass context structure.
AVCodecContext * audio_enc
AVCodecContext * video_enc
const char * name
Name of the codec described by this descriptor.
int error
contains the error code or 0 if no error happened
This struct describes the properties of a single codec described by an AVCodecID. ...
void avio_wb16(AVIOContext *s, unsigned int val)
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.
static void flush_put_bits(PutBitContext *s)
Pad the end of the output stream with zeros.
int64_t nb_frames
number of frames in this stream if known or 0
static void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
Initialize the PutBitContext s.
int channels
number of audio channels
void * priv_data
Format private data.
static void write_header(FFV1Context *f)
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
void avio_wb32(AVIOContext *s, unsigned int val)
int64_t duration
Duration of the stream, in AV_TIME_BASE fractional seconds.
#define AV_DICT_IGNORE_SUFFIX
Return first entry in a dictionary whose first part corresponds to the search key, ignoring the suffix of the found key string.
This structure stores compressed data.
static int write_packet(AVFormatContext *s1, AVPacket *pkt)
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
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.