138 "FLV only supports wideband (16kHz) Speex audio\n");
175 "FLV does not support sample rate %d, "
176 "choose from (44100, 22050, 11025)\n", par->
sample_rate);
236 avio_w8(pb, (ts >> 24) & 0x7F);
279 int metadata_count = 0;
302 if (write_duration_filesize) {
307 if (write_duration_filesize) {
358 if( !strcmp(
tag->key,
"width")
359 ||!strcmp(
tag->key,
"height")
360 ||!strcmp(
tag->key,
"videodatarate")
361 ||!strcmp(
tag->key,
"framerate")
362 ||!strcmp(
tag->key,
"videocodecid")
363 ||!strcmp(
tag->key,
"audiodatarate")
364 ||!strcmp(
tag->key,
"audiosamplerate")
365 ||!strcmp(
tag->key,
"audiosamplesize")
366 ||!strcmp(
tag->key,
"stereo")
367 ||!strcmp(
tag->key,
"audiocodecid")
368 ||!strcmp(
tag->key,
"duration")
369 ||!strcmp(
tag->key,
"onMetaData")
370 ||!strcmp(
tag->key,
"datasize")
371 ||!strcmp(
tag->key,
"lasttimestamp")
372 ||!strcmp(
tag->key,
"totalframes")
373 ||!strcmp(
tag->key,
"hasAudio")
374 ||!strcmp(
tag->key,
"hasVideo")
375 ||!strcmp(
tag->key,
"hasCuePoints")
376 ||!strcmp(
tag->key,
"hasMetadata")
377 ||!strcmp(
tag->key,
"hasKeyframes")
388 if (write_duration_filesize) {
467 avio_seek(pb, metadata_count_pos, SEEK_SET);
482 "%s codec %s not compatible with flv\n",
509 int samplerate_index;
514 for (samplerate_index = 0; samplerate_index < 16;
522 put_bits(&pbc, 4, samplerate_index);
543 avio_seek(pb, -data_size - 10, SEEK_CUR);
590 metadata_size += 2 + 13;
591 metadata_size += 2 + 5;
596 if (metadata_size < 0)
597 return metadata_size;
604 read_buf[1] = buf + metadata_size;
619 "the second pass (add_keyframe_index)\n",
s->url);
630 #define READ_BLOCK do { \
631 read_size[read_buf_id] = avio_read(read_pb, read_buf[read_buf_id], metadata_size); \
639 n = read_size[read_buf_id];
644 }
while (
pos <= pos_end);
658 for (
i = 0;
i <
s->nb_streams;
i++) {
663 if (
s->streams[
i]->avg_frame_rate.den &&
664 s->streams[
i]->avg_frame_rate.num) {
669 "at most one video stream is supported in flv\n");
684 "use vstrict=-1 / -strict -1 to use it anyway.\n");
689 "Muxing VP6 in flv will produce flipped video on playback.\n");
695 "at most one audio stream is supported in flv\n");
703 "16-bit big-endian audio in flv is valid but most likely unplayable (hardware dependent); use s16le\n");
728 s->streams[
i]->priv_data = sc;
750 for (
i = 0;
i <
s->nb_streams;
i++)
751 if (
s->streams[
i]->codecpar->codec_tag == 5) {
766 for (
i = 0;
i <
s->nb_streams;
i++) {
783 if (build_keyframes_idx) {
820 while (newflv_posinfo) {
821 p = newflv_posinfo->
next;
828 newflv_posinfo =
NULL;
843 for (
i = 0;
i <
s->nb_streams;
i++) {
854 if (build_keyframes_idx) {
887 int flags = -1, flags_size, ret = 0;
921 "Packets are not in the proper order with respect to DTS\n");
973 "use the audio bitstream filter 'aac_adtstoasc' to fix it "
974 "('-bsf:a aac_adtstoasc' option with ffmpeg)\n");
983 "8 frames per packet. Adobe Flash "
984 "Player cannot handle this!\n");
989 if (
size + flags_size >= 1<<24) {
991 size + flags_size, 1<<24);
1023 data_size =
avio_tell(pb) - metadata_size_pos;
1024 avio_seek(pb, metadata_size_pos - 10, SEEK_SET);
1026 avio_seek(pb, data_size + 10 - 3, SEEK_CUR);
1099 {
"flvflags",
"FLV muxer flags", offsetof(
FLVContext,
flags),
AV_OPT_TYPE_FLAGS, {.i64 = 0}, INT_MIN, INT_MAX,
AV_OPT_FLAG_ENCODING_PARAM,
"flvflags" },
1118 .mime_type =
"video/x-flv",
1119 .extensions =
"flv",
static const int mpeg4audio_sample_rates[16]
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int ff_isom_write_avcc(AVIOContext *pb, const uint8_t *data, int len)
int ff_avc_parse_nal_units_buf(const uint8_t *buf_in, uint8_t **buf, int *size)
#define FF_COMPLIANCE_UNOFFICIAL
Allow unofficial extensions.
void avio_write_marker(AVIOContext *s, int64_t time, enum AVIODataMarkerType type)
Mark the written bytestream as a specific type.
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
void avio_w8(AVIOContext *s, int b)
void avio_wb32(AVIOContext *s, unsigned int val)
void avio_wb16(AVIOContext *s, unsigned int val)
#define AVIO_FLAG_READ
read-only
@ AVIO_DATA_MARKER_BOUNDARY_POINT
A point in the output bytestream where a demuxer can start parsing (for non self synchronizing bytest...
@ AVIO_DATA_MARKER_SYNC_POINT
A point in the output bytestream where a decoder can start decoding (i.e.
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
void avio_wb24(AVIOContext *s, unsigned int val)
void avio_wb64(AVIOContext *s, uint64_t val)
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
void avio_flush(AVIOContext *s)
Force flushing of buffered data.
uint8_t * av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type, buffer_size_t *size)
static av_cold int init(AVCodecContext *avctx)
#define flags(name, subs,...)
#define CONFIG_LIBMP3LAME
static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int unqueue)
static void write_header(FFV1Context *f)
const char * avcodec_get_name(enum AVCodecID id)
Get the name of a codec.
const AVCodecDescriptor * avcodec_descriptor_get(enum AVCodecID id)
@ AV_CODEC_ID_TEXT
raw UTF-8 text
@ AV_CODEC_ID_MP3
preferred ID for decoding MPEG audio layer 1, 2 or 3
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
@ AV_PKT_DATA_NEW_EXTRADATA
The AV_PKT_DATA_NEW_EXTRADATA is used to notify the codec or the format that the extradata buffer was...
#define AV_DICT_IGNORE_SUFFIX
Return first entry in a dictionary whose first part corresponds to the search key,...
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const char * av_default_item_name(void *ptr)
Return the context name.
static double av_q2d(AVRational a)
Convert an AVRational to a double.
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
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.
@ AVMEDIA_TYPE_DATA
Opaque data information usually continuous.
#define AV_NOPTS_VALUE
Undefined timestamp value.
#define AV_TIME_BASE
Internal time base represented as integer.
#define LIBAVUTIL_VERSION_INT
static av_always_inline uint64_t av_double2int(double f)
Reinterpret a double as a 64-bit integer.
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static int check_bitstream(AVFormatContext *s, AVStream *st, AVPacket *pkt)
#define AV_OPT_FLAG_ENCODING_PARAM
a generic parameter which can be set by the user for muxing or encoding
static void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
Initialize the PutBitContext s.
static void flush_put_bits(PutBitContext *s)
Pad the end of the output stream with zeros.
Describe the class of an AVClass context structure.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
This struct describes the properties of a single codec described by an AVCodecID.
This struct describes the properties of an encoded stream.
int extradata_size
Size of the extradata content in bytes.
int bits_per_coded_sample
The number of bits per sample in the codedwords.
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
enum AVMediaType codec_type
General type of the encoded data.
int profile
Codec-specific bitstream restrictions that the stream conforms to.
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
int sample_rate
Audio only.
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
This structure stores compressed data.
int flags
A combination of AV_PKT_FLAG values.
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
AVCodecParameters * codecpar
Codec parameters associated with this stream.
int64_t lastkeyframelocation
int64_t filepositions_count
AVCodecParameters * data_par
int64_t keyframes_info_offset
int64_t metadata_totalsize
int64_t lastkeyframetimestamp_offset
int64_t metadata_totalsize_pos
int64_t delay
first dts delay (needed for AVC & Speex)
AVCodecParameters * video_par
FLVFileposition * filepositions
int64_t metadata_size_pos
int64_t lastkeyframelocation_offset
AVCodecParameters * audio_par
FLVFileposition * head_filepositions
double lastkeyframetimestamp
int64_t keyframe_index_size
int64_t lasttimestamp_offset
struct FLVFileposition * next
double keyframe_timestamp
int64_t keyframe_position
int64_t last_ts
last timestamp for each stream
#define av_malloc_array(a, b)
static void error(const char *err)
static int write_trailer(AVFormatContext *s1)