Go to the documentation of this file.
137 "FLV only supports wideband (16kHz) Speex audio\n");
174 "FLV does not support sample rate %d, "
175 "choose from (44100, 22050, 11025)\n", par->
sample_rate);
235 avio_w8(pb, (ts >> 24) & 0x7F);
278 int metadata_count = 0;
279 int64_t metadata_count_pos;
301 if (write_duration_filesize) {
306 if (write_duration_filesize) {
357 if( !strcmp(
tag->key,
"width")
358 ||!strcmp(
tag->key,
"height")
359 ||!strcmp(
tag->key,
"videodatarate")
360 ||!strcmp(
tag->key,
"framerate")
361 ||!strcmp(
tag->key,
"videocodecid")
362 ||!strcmp(
tag->key,
"audiodatarate")
363 ||!strcmp(
tag->key,
"audiosamplerate")
364 ||!strcmp(
tag->key,
"audiosamplesize")
365 ||!strcmp(
tag->key,
"stereo")
366 ||!strcmp(
tag->key,
"audiocodecid")
367 ||!strcmp(
tag->key,
"duration")
368 ||!strcmp(
tag->key,
"onMetaData")
369 ||!strcmp(
tag->key,
"datasize")
370 ||!strcmp(
tag->key,
"lasttimestamp")
371 ||!strcmp(
tag->key,
"totalframes")
372 ||!strcmp(
tag->key,
"hasAudio")
373 ||!strcmp(
tag->key,
"hasVideo")
374 ||!strcmp(
tag->key,
"hasCuePoints")
375 ||!strcmp(
tag->key,
"hasMetadata")
376 ||!strcmp(
tag->key,
"hasKeyframes")
387 if (write_duration_filesize) {
466 avio_seek(pb, metadata_count_pos, SEEK_SET);
481 "%s codec %s not compatible with flv\n",
508 int samplerate_index;
513 for (samplerate_index = 0; samplerate_index < 16;
521 put_bits(&pbc, 4, samplerate_index);
542 avio_seek(pb, -data_size - 10, SEEK_CUR);
579 int64_t metadata_size = 0;
583 metadata_size += 2 + 13;
584 metadata_size += 2 + 5;
589 if (metadata_size < 0)
590 return metadata_size;
610 for (
i = 0;
i <
s->nb_streams;
i++) {
615 if (
s->streams[
i]->avg_frame_rate.den &&
616 s->streams[
i]->avg_frame_rate.num) {
621 "at most one video stream is supported in flv\n");
636 "use vstrict=-1 / -strict -1 to use it anyway.\n");
641 "Muxing VP6 in flv will produce flipped video on playback.\n");
647 "at most one audio stream is supported in flv\n");
655 "16-bit big-endian audio in flv is valid but most likely unplayable (hardware dependent); use s16le\n");
680 s->streams[
i]->priv_data = sc;
702 for (
i = 0;
i <
s->nb_streams;
i++)
703 if (
s->streams[
i]->codecpar->codec_tag == 5) {
718 for (
i = 0;
i <
s->nb_streams;
i++) {
735 if (build_keyframes_idx) {
782 for (
i = 0;
i <
s->nb_streams;
i++) {
793 if (build_keyframes_idx) {
826 int flags = -1, flags_size,
ret = 0;
860 "Packets are not in the proper order with respect to DTS\n");
912 "use the audio bitstream filter 'aac_adtstoasc' to fix it "
913 "('-bsf:a aac_adtstoasc' option with ffmpeg)\n");
922 "8 frames per packet. Adobe Flash "
923 "Player cannot handle this!\n");
928 if (
size + flags_size >= 1<<24) {
930 size + flags_size, 1<<24);
942 int64_t metadata_size_pos =
avio_tell(pb);
962 data_size =
avio_tell(pb) - metadata_size_pos;
963 avio_seek(pb, metadata_size_pos - 10, SEEK_SET);
965 avio_seek(pb, data_size + 10 - 3, SEEK_CUR);
1000 int64_t
pos = cur_offset;
1052 {
"flvflags",
"FLV muxer flags", offsetof(
FLVContext,
flags),
AV_OPT_TYPE_FLAGS, {.i64 = 0}, INT_MIN, INT_MAX,
AV_OPT_FLAG_ENCODING_PARAM,
"flvflags" },
1071 .mime_type =
"video/x-flv",
1072 .extensions =
"flv",
static void error(const char *err)
int64_t metadata_totalsize
AVCodecParameters * audio_par
#define AMF_END_OF_OBJECT
#define AV_LOG_WARNING
Something somehow does not look correct.
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
@ AVIO_DATA_MARKER_BOUNDARY_POINT
A point in the output bytestream where a demuxer can start parsing (for non self synchronizing bytest...
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
enum AVMediaType codec_type
General type of the encoded data.
FLVFileposition * filepositions
This struct describes the properties of an encoded stream.
int64_t delay
first dts delay (needed for AVC & Speex)
static void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
Initialize the PutBitContext s.
static int check_bitstream(AVFormatContext *s, FFStream *sti, AVPacket *pkt)
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
static void deinit(AVFormatContext *s)
int64_t metadata_totalsize_pos
#define AV_DICT_IGNORE_SUFFIX
Return first entry in a dictionary whose first part corresponds to the search key,...
@ FLV_FRAME_KEY
key frame (for AVC, a seekable frame)
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
int nb_channels
Number of channels in this layout.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
#define FF_COMPLIANCE_UNOFFICIAL
Allow unofficial extensions.
int64_t lasttimestamp_offset
void avio_write_marker(AVIOContext *s, int64_t time, enum AVIODataMarkerType type)
Mark the written bytestream as a specific type.
int64_t lastkeyframelocation_offset
double lastkeyframetimestamp
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
@ AV_CODEC_ID_MP3
preferred ID for decoding MPEG audio layer 1, 2 or 3
#define FLV_AUDIO_CODECID_OFFSET
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int64_t keyframe_position
int64_t lastkeyframelocation
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
@ FLV_FRAME_INTER
inter frame (for AVC, a non-seekable frame)
AVCodecParameters * video_par
int64_t filepositions_count
This struct describes the properties of a single codec described by an AVCodecID.
#define AV_OPT_FLAG_ENCODING_PARAM
a generic parameter which can be set by the user for muxing or encoding
static double av_q2d(AVRational a)
Convert an AVRational to a double.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
@ FLV_SAMPLERATE_SPECIAL
signifies 5512Hz and 8000Hz in the case of NELLYMOSER
@ FLV_CODECID_NELLYMOSER_16KHZ_MONO
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
@ AVMEDIA_TYPE_DATA
Opaque data information usually continuous.
FLVFileposition * head_filepositions
int ff_format_shift_data(AVFormatContext *s, int64_t read_start, int shift_size)
Make shift_size amount of space at read_start by shifting data in the output at read_start until the ...
AVCodecParameters * codecpar
Codec parameters associated with this stream.
#define LIBAVUTIL_VERSION_INT
Describe the class of an AVClass context structure.
static int write_trailer(AVFormatContext *s1)
@ FLV_CODECID_NELLYMOSER_8KHZ_MONO
const char * av_default_item_name(void *ptr)
Return the context name.
int ff_avc_parse_nal_units_buf(const uint8_t *buf_in, uint8_t **buf, int *size)
void avio_w8(AVIOContext *s, int b)
AVChannelLayout ch_layout
Audio only.
int sample_rate
Audio only.
double keyframe_timestamp
int64_t keyframes_info_offset
int extradata_size
Size of the extradata content in bytes.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
int ff_isom_write_avcc(AVIOContext *pb, const uint8_t *data, int len)
int ff_standardize_creation_time(AVFormatContext *s)
Standardize creation_time metadata in AVFormatContext to an ISO-8601 timestamp string.
#define AV_NOPTS_VALUE
Undefined timestamp value.
int profile
Codec-specific bitstream restrictions that the stream conforms to.
@ AVIO_DATA_MARKER_SYNC_POINT
A point in the output bytestream where a decoder can start decoding (i.e.
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
void avio_wb32(AVIOContext *s, unsigned int val)
AVCodecParameters * data_par
int flags
A combination of AV_PKT_FLAG values.
const char * avcodec_get_name(enum AVCodecID id)
Get the name of a codec.
static av_always_inline uint64_t av_double2int(double f)
Reinterpret a double as a 64-bit integer.
#define i(width, name, range_min, range_max)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
uint8_t * av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type, size_t *size)
Get side information from packet.
int64_t keyframe_index_size
#define AV_TIME_BASE
Internal time base represented as integer.
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
int64_t metadata_size_pos
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
@ AMF_DATA_TYPE_MIXEDARRAY
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
@ AV_CODEC_ID_TEXT
raw UTF-8 text
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.
int ff_stream_add_bitstream_filter(AVStream *st, const char *name, const char *args)
Add a bitstream filter to a stream.
int64_t lastkeyframetimestamp_offset
@ 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...
int64_t last_ts
last timestamp for each stream
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
void avio_wb64(AVIOContext *s, uint64_t val)
const int ff_mpeg4audio_sample_rates[16]
int bits_per_coded_sample
The number of bits per sample in the codedwords.
static void flush_put_bits(PutBitContext *s)
Pad the end of the output stream with zeros.
void avio_wb24(AVIOContext *s, unsigned int val)
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
This structure stores compressed data.
void avio_wb16(AVIOContext *s, unsigned int val)
#define flags(name, subs,...)
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
const AVCodecDescriptor * avcodec_descriptor_get(enum AVCodecID id)
static int write_packet(AVFormatContext *s1, AVPacket *pkt)
static void write_header(FFV1Context *f)
struct FLVFileposition * next
@ FLV_HEADER_FLAG_HASAUDIO
@ FLV_HEADER_FLAG_HASVIDEO
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