summaryrefslogtreecommitdiff
path: root/libavformat
Commit message (Collapse)AuthorAge
* avformat/dashenc: fix typo in ProducerReferenceTime elementsJames Almer2020-04-15
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/movenc: remove call to av_copy_packet_side_data() when ↵James Almer2020-04-15
| | | | | | | | | | | | concatenating eac3 syncframes This generates a potential memory leak, and mixes side data from the last packet with other properties from the first. Keep all the properties from the first packet only in the output packet instead. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/dashdec: add attribute lang for audio and subtitle streamsSteven Liu2020-04-15
| | | | | | There should have language in the metadata of streams which show to user Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/hlsenc: add hls_fmp4_init_resend optionSteven Liu2020-04-15
| | | | | | add option for resend init file after m3u8 refresh everytime. Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/filmstripenc: Use ff_raw_write_packet()Andreas Rheinhardt2020-04-14
| | | | | | | | | The only difference of the currently used write_packet()-function to ff_raw_write_packet() is that the former also counts the number of frames. Yet doing so in the muxer itself is unnecessary as this is already done generically in write_packet() in libavformat/mux.c. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/rso: Don't reimplement ff_raw_write_packet()Andreas Rheinhardt2020-04-14
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/amr: Don't reimplement ff_raw_write_packet()Andreas Rheinhardt2020-04-14
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/Makefile: Don't add dependency twiceAndreas Rheinhardt2020-04-14
| | | | | | as has happened with flac_picture.o and the Matroska demuxer. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/Makefile: Remove false dependencies of WebM and Matroska muxerAndreas Rheinhardt2020-04-14
| | | | | | | | | | | These muxers don't depend on the WebM Chunk or the WebM DASH Manifest muxers. Furthermore, remove some #if checks in webm_chunk.c and webmdashenc.c. They are always true now that webm_chunk.c and webmdashenc.c are only compiled when their corresponding muxers are enabled. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/Makefile: Remove false dependency of WebM DASH manifest muxerAndreas Rheinhardt2020-04-14
| | | | | | It does not use anything from libavformat/matroska.c. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/webmdashenc: Remove unnecessary headerAndreas Rheinhardt2020-04-14
| | | | | | | avio_internal.h has been included in this muxer since the beginning and was never needed. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/webm_chunk: Remove superfluous headersAndreas Rheinhardt2020-04-14
| | | | | | | libavutil/avstring.h is unnecessary since 8a632b3e. The other unnecessary headers were never used. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* configure, libavformat/Makefile: Fix webm_chunk dependenciesAndreas Rheinhardt2020-04-14
| | | | | | | | | The webm_chunk muxer requires the WebM muxer, yet it does not directly require anything from libavformat/matroska.c (it does not even include the corresponding header). So remove the dependency from the Makefile and add a _select to configure. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/matroskaenc: Don't write elements with their default valueAndreas Rheinhardt2020-04-14
| | | | | | | | | This has happened when writing chapters: Both editions as well as chapters are by default not hidden and given that we don't support writing hidden chapters at all, we don't need to write said elements at all. The same goes for ChapterFlagEnabled. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/movenc: write the mdcv atom by defaultMichael Bradshaw2020-04-13
| | | | | | | | | | The mdcv atom isn't in ISO/IEC 14496-12:2015 but it is expected to be added soon. See: http://ffmpeg.org/pipermail/ffmpeg-devel/2020-April/259529.html The mdcv atom is already parsed in FFmpeg in mov.c. Signed-off-by: Michael Bradshaw <mjbshaw@google.com>
* avformat/movenc: remove the write_clli mov flagMichael Bradshaw2020-04-13
| | | | | | | | | The clli atom is expected to be standardized soon. See http://ffmpeg.org/pipermail/ffmpeg-devel/2020-April/259529.html We now write the clli atom by default. Signed-off-by: Michael Bradshaw <mjbshaw@google.com>
* avformat/movenc: stop guessing colr atom valuesMichael Bradshaw2020-04-13
|
* avformat/movenc: use enum values directly for colr atomMichael Bradshaw2020-04-13
| | | | | | | | | | | | | | | | | | | | | | | The switch cases were missing: - Primaries: bt470m, film, smpte428, and ebu3213. - TRCs: gamma22, gamma28, linear, log, log_sqrt, iec61966_2_4, bt1361, iec61966_2_1, bt2020_10bit, and bt2020_12bit. - Space: rgb, fcc, ycgco, bt2020_cl, smpte2085, chroma-derived-nc, chroma-derived-c, and ictcp. They also annoyingly remapped the following (which are functionally equivalent but can be treated differently by clients): - smpte240m primaries to smpte170m. - smpte170m TRC to bt709. - bt470bg color space to smpte170m. The enum values in FFmpeg are the same values as ITU-T H.273 and ISO/IEC 23001-8 so we can just use them directly, which is both simpler and preserves the user intent. Signed-off-by: Michael Bradshaw <mjbshaw@google.com>
* avformat/matroskaenc: Change signature of mkv_write_track()Andreas Rheinhardt2020-04-13
| | | | | | | | | | | | Up until now, mkv_write_track() received the index of the stream whose header data it is about to write as parameter; this index has until recently been explicitly used to generate both TrackNumber and TrackUID. But this is no longer so and as there is no reason why the function for writing a single TrackEntry should even know the index of the TrackEntry it is about to write, said index is replaced in the list of function parameters by the corresponding AVStream and mkv_track. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/matroskaenc: Automatically use right TrackNumber in CuesAndreas Rheinhardt2020-04-13
| | | | | | | | | | | mkv_cuepoint (the structure used to store the index entries in the Matroska muxer) currently contains fields for both the index of the packet's stream in the AVFormatContext.streams array and for the Matroska TrackNumber; correspondingly, mkv_add_cuepoint() has parameters for both. But these two numbers can't be chosen independently, so get rid of the TrackNumber. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/matroskaenc: Ignore AttachedFiles for track limitAndreas Rheinhardt2020-04-13
| | | | | | | | | | | | | | | | | Attachments are streams in FFmpeg, but they are not tracks in Matroska. Yet they were counted when checking a limit for the number of tracks that the Matroska muxer imposes. This is unnecessary and has been changed. Also use unsigned variables for the variables denoting TrackNumbers as negative TrackNumbers are impossible. (The Matroska file format actually has practically no limit on the number of tracks and this is purely what our muxer supports. But even if this limit were removed/relaxed in the future, it still makes sense to use small TrackNumbers as this patch does, because greater numbers need more bytes to encode.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/matroskaenc: Make output more deterministicAndreas Rheinhardt2020-04-13
| | | | | | | | | | | | | | | | | | | | | Using random values for TrackUID and FileUID (as happens when the AVFMT_FLAG_BITEXACT flag is not set) has the obvious downside of making the output indeterministic. This commit mitigates this by writing the potentially random values with a fixed size of eight byte, even if their actual values would fit into less than eight bytes. This ensures that even in non-bitexact mode, the differences between two files generated with the same settings are restricted to a few bytes in the header. (Namely the SegmentUID, the TrackUIDs (in Tracks as well as when referencing them via TagTrackUID), the FileUIDs (in Attachments as well as in TagAttachmentUID) as well as the CRC-32 checksums of the Info, Tracks, Attachments and Tags level-1-elements.) Without this patch, there might be an offset/a size difference between two such files. The FATE-tests had to be updated because the fixed-sized UIDs are also used in bitexact mode. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/matroskaenc: Remove allocations for AttachmentsAndreas Rheinhardt2020-04-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If there are Attachments to write, the Matroska muxer currently allocates two objects: An array that contains an entry for each AttachedFile containing just the stream index of the corresponding stream and the FileUID used for this AttachedFile; and a structure with a pointer to said array and a counter for said array. These uids are generated via code special to Attachments: It uses an AVLFG in the normal and a sha of the attachment data in the bitexact case. (Said sha requires an allocation, too.) But now that an uid is generated for each stream in mkv_init(), there is no need any more to use special code for generating the FileUIDs of AttachedFiles: One can simply use the uid already generated for the corresponding stream. And this makes the whole allocations of the structures for AttachedFiles as well as the structures itself superfluous. They have been removed. In case AVFMT_FLAG_BITEXACT is set, the uids will be different from the old ones which is the reason why the FATE-test lavf-mkv_attachment needed to be updated. The old method had the drawback that two AttachedFiles with the same data would have the same FileUID. The new one doesn't. Also notice that the dynamic buffer used to write the Attachments leaks if an error happens when writing the buffer. By removing the allocations potential sources of errors have been removed. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/matroskaenc: Reuse random seedAndreas Rheinhardt2020-04-13
| | | | | | | | This commit reuses the random seed generated in mkv_init() (to determine the TrackUIDs) for the SegmentUID in order to avoid a potentially expensive call to av_get_random_seed(). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/matroskaenc: Use random TrackUIDAndreas Rheinhardt2020-04-13
| | | | | | | | | | | | | | | | | | | Up until now, the TrackUID of a Matroska track which is supposed to be random was not random at all: It always coincided with the TrackNumber which is usually the 1-based index of the corresponding stream in the array of AVStreams. This has been changed: It is now set via an AVLFG if AVFMT_FLAG_BITEXACT is not set. Otherwise it is set like it is set now (the only change happens if an explicit track number has been chosen via dash_track_number, because the system used in the normal situation is now used, too). In particular, no FATE tests need to be updated. This also fixes a bug in case the dash_track_number option was used: In this case the TrackUID was set to the provided number, but the tags were written with a TagTrackUID simply based upon the index, so that the tags didn't apply to the track they ought to apply to. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/matroskaenc: Don't waste bytes writing durationsAndreas Rheinhardt2020-04-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Tags in the Matroska file format can be summarized as follows: There is a level 1-element called Tags containing one or many Tag elements each of which in turn contain a Targets element and one or many SimpleTags. Each SimpleTag roughly corresponds to a single key-value pair similar to an AVDictionaryEntry. The Targets meanwhile contains information to what the metadata contained in the SimpleTags contained in the containing Tag applies (i.e. to the file as a whole or to an individual track). The Matroska muxer writes such metadata. It puts the metadata of every stream into a Tag whose Targets makes it point to the corresponding track. And if the output is seekable, then it also adds another Tag for each track whose Targets corresponds to the track and where it reserves space in a SimpleTag to write the duration at the end of the muxing process into. Yet there is no reason to write two Tag elements for a track and a few bytes (typically 24 bytes per track) can be saved by adding the duration SimpleTag to the other Tag of the same track (if it exists). FATE has been updated because the output files changed. (Tests that write to unseekable output (pipes) needn't be updated (no duration tag has ever been written for them) and the same applies to tests without further metadata.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/matroskaenc: Ensure that ChapterUID are != 0Andreas Rheinhardt2020-04-13
| | | | | | | | | | | | | | | | | | | | | | | | | | AVChapters have an int as id field and therefore this value can appear <= 0. When remuxing from Matroska, this value actually contains the lower 32 bits of the original ChapterUID (which can be 64 bits). In order to ensure that the ChapterUID is always > 0, they were offset as follows (since 07704c61): First max(0, 1LL - chapter[i].id) was computed and stored in an uint32_t. And then the IDs were offset using this value. This has two downsides: 1. It does not ensure that the UID is actually != 0: Namely if there is a chapter with id == INT_MIN, then the offset will be 2^31 + 1 and a chapter with id == INT_MAX will become 2^31 - 1 + 2^31 + 1 = 2^32 = 0, because the actual calculation was performed in 32 bits. 2. As soon as a chapter id appears to be negative, a nontrivial offset is used, so that not even a ChapterUID that only uses 32 bits is preserved. So change this by treating the id as an unsigned value internally and only offset (by 1) if an id vanishes. The actual offsetting then has to be performed in 64 bits in order to make sure that no UINT32_MAX wraps around. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/Makefile: Add missing rawenc dependency for iLBC muxerAndreas Rheinhardt2020-04-12
| | | | | | Forgotten in ab502fab. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/oggdec: Check for EOF after page headerMichael Niedermayer2020-04-12
| | | | | | | Fixes: Infinite loop Fixes: Ticket8594 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* libavformat/mov: fix multiple trun per trafJohn Stebbins2020-04-11
| | | | | | | | | dts would start over at the beginning of each trun when they should be computed contiguously for each trun in a traf Fixes ticket 8070 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* mov: fix seek to next root atom in fragmented mp4John Stebbins2020-04-11
| | | | | | | | | If some but not all moof's are referenced in an sidx, whole fragments were being skipped. Fixes tickets 7377, 7389, and 8502 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf/oggparsevorbis: Use case-insensitive key compare for vorbis pictureMattias Wadman2020-04-11
| | | | | | | Regression since 8d3630c5402fdda2889fe4f74f7dcdd50ebca654 where keys were changed to not be touppered but the picture block strcmp was not changed to be case-insensitive. Fixes ticket #8608.
* libavformat/mov: restore use of mfra time as dtsJohn Stebbins2020-04-11
| | | | | | This was inadvertantly removed in 4a9d32baca Reviewed-by: Gyan Doshi <ffmpeg@gyani.pro>
* avcodec: add MV30 decoderPaul B Mahol2020-04-10
|
* avformat/hlsenc: return media_url directly if failed to get seperatorLimin Wang2020-04-10
| | | | | Fix ticket: 8606 Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/matroskaenc: Remove unnecessary headersAndreas Rheinhardt2020-04-10
| | | | | | | | | | | | subtitles.h has been included in order to use ff_subtitles_next_line() to help parsing srt subtitles which at that time had their timing as part of the payload and not as part of the AVPacket fields. When this changed (in 55180b32) it has been forgotten to remove this header. libavcodec/internal.h meanwhile has been added in bb47aa5850c and has never been used at all. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/mpeg: Don't use unintialized valueAndreas Rheinhardt2020-04-09
| | | | | | | | vobsub_read_packet() didn't check whether an array of AVPackets was valid and therefore used uninitialized values. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/segment: always use interleaved writes for formats with custom ↵Marton Balint2020-04-08
| | | | | | interleaving Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/hlsenc: use av_asprintf()Limin Wang2020-04-08
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/hlsenc: Factor out deleting files from deleting segmentsAndreas Rheinhardt2020-04-08
| | | | | | Removes code duplication. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat: add subtitle support in master playlist m3u8Limin Wang2020-04-08
| | | | | | | | | | | | | | | | | | | | | | | | | Test with the following command for the webvtt subtitle: $ ./ffmpeg -y -i input_with_subtitle.mkv \ -b:v:0 5250k -c:v h264 -pix_fmt yuv420p -profile:v main -level 4.1 \ -b:a:0 256k \ -c:s webvtt -c:a mp2 -ar 48000 -ac 2 -map 0:v -map 0:a:0 -map 0:s:0 \ -f hls -var_stream_map "v:0,a:0,s:0,sgroup:subtitle" \ -master_pl_name master.m3u8 -t 300 -hls_time 10 -hls_init_time 4 -hls_list_size \ 10 -master_pl_publish_rate 10 -hls_flags \ delete_segments+discont_start+split_by_time ./tmp/video.m3u8 Check the master m3u8: $ cat tmp/master.m3u8 #EXTM3U #EXT-X-VERSION:3 #EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subtitle",NAME="subtitle_0",DEFAULT=YES,URI="video_vtt.m3u8" #EXT-X-STREAM-INF:BANDWIDTH=6056600,RESOLUTION=1280x720,CODECS="avc1.4d4829,mp4a.40.33",SUBTITLES="subtitle" video.m3u8 Check the result by convert to mkv: $ ./ffmpeg -strict experimental -i ./tmp/master.m3u8 -c:v copy -c:a mp2 -c:s srt ./test.mkv Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/hlsplaylist: simplify code for checking whether the string is emptyLimin Wang2020-04-08
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/hlsenc: remove the first slash of the relative path line in the ↵Limin Wang2020-04-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | master m3u8 file Please testing with the following command: ./ffmpeg -y -i input.mkv \ -b:v:0 5250k -c:v h264 -pix_fmt yuv420p -profile:v main -level 4.1 \ -b:a:0 256k \ -c:a mp2 -ar 48000 -ac 2 -map 0:v -map 0:a:0\ -f hls -var_stream_map "v:0,a:0" \ -master_pl_name master.m3u8 -t 300 -hls_time 10 -hls_init_time 4 -hls_list_size \ 10 -master_pl_publish_rate 10 -hls_flags \ delete_segments+discont_start+split_by_time ./tmp/video.m3u8 then cat ./tmp/master.m3u8 before: #EXTM3U #EXT-X-VERSION:3 #EXT-X-STREAM-INF:BANDWIDTH=6056600,RESOLUTION=1280x720,CODECS="avc1.4d4829,mp4a.40.33" /video.m3u8 $ ./ffmpeg -i ./tmp/master.m3u8 -c:v copy -c:a mp2 ./test.mkv [hls @ 0x7f82f9000000] Skip ('#EXT-X-VERSION:3') [hls @ 0x7f82f9000000] Opening '/video.m3u8' for reading [hls @ 0x7f82f9000000] parse_playlist error No such file or directory [/video.m3u8] ./tmp/master.m3u8: No such file or directory after: #EXTM3U #EXT-X-VERSION:3 #EXT-X-STREAM-INF:BANDWIDTH=6056600,RESOLUTION=1280x720,CODECS="avc1.4d4829,mp4a.40.33" video.m3u8 Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/hlsenc: Use AVBPrint to avoid allocations of stringsAndreas Rheinhardt2020-04-08
| | | | | | when deleting old segments. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/hlsenc: Fix memleak when deleting old segmentsAndreas Rheinhardt2020-04-08
| | | | | | | | | | | if the directory name of the segments contains "%v". This memleak is caused by masking the pointer that will eventually be freed by a variable of the same name in a smaller scope. Therefore the pointer that gets freed is always NULL when it is freed and the allocated data leaks. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/smacker: CosmeticsAndreas Rheinhardt2020-04-08
| | | | | | | | | | This is mainly about improving legibility of the code and getting rid of overlong lines by using variables for st->codecpar instead of accessing the codecparameters via st->codecpar->. Also, some code has been moved to better fitting places. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/smacker: Remove unused structureAndreas Rheinhardt2020-04-08
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/smacker: Only store what is needed laterAndreas Rheinhardt2020-04-08
| | | | | | | | This commit removes data that is only used during smacker_read_header() from the demuxer's context and replaces the data that is used by local variables. The other data is completely dropped. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/smacker: Create audio streams immediatelyAndreas Rheinhardt2020-04-08
| | | | | | | | | | | | | | | | | | | The Smacker demuxer currently parses several fields that indicate how many audio streams a file contains. This data is parsed and stored into arrays in the demuxer's context and although the data is used only to initialize the audio streams, it is kept for the whole lifetime of the demuxer. This has been changed: The data is used directly to create the audio streams and no longer kept at all. This also simplifies error handling in case adding a new stream fails: Several arrays which until now have been allocated between parsing the data determining how many audio streams to create and actually creating them would need to be freed in this case. Now the streams are created first, so freeing is no longer an issue. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/smacker: Read extradata directly into extradataAndreas Rheinhardt2020-04-08
| | | | | | | | | | | | | | | | | | | | | The Smacker demuxer reads four consecutive 32bit values from the file header into its demux context (as four uint32_t), converting it to native endianness in the process and then writing these four values later (after extradata has been allocated) to extradata as four 32bit values (converting to little endian in the process). This commit changes this: The stream and the extradata are allocated earlier, so that the data destined for extradata can be read directly into extradata. Furthermore, given that these values are not needed for demuxing itself they are now no longer kept as part of the demuxing context. Finally, a check regarding the number of frames has been moved up, too, in order to exit early before unnecessarily allocating the stream and the extradata. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>