aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/movenc.c
Commit message (Collapse)AuthorAgeFilesLines
...
* lavf/movenc: small cleanup for styleJun Zhao2024-03-261-36/+35
| | | | | | | | | Small cleanup for style, indent, switch case lables. BTW, the preferred way to ease multiple indentation levels in a switch statement is to align the switch and its subordinate case labels in the same column Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
* avformat/mux: Rename FF_FMT_ALLOW_FLUSH->FF_OFMT_FLAG_ALLOW_FLUSHAndreas Rheinhardt2024-03-221-9/+9
| | | | | | | It better reflects that this is a muxer-only flag. Also document the flag. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/movenc: only compile avif_write_trailer() when the avif muxer is ↵James Almer2024-03-201-0/+2
| | | | | | enabled Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/movenc: Make check actually check what is intendedAndreas Rheinhardt2024-02-201-1/+1
| | | | | | | | | Also fixes a Clang warning: "overlapping comparisons always evaluate to false [-Wtautological-overlap-compare]" Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/movenc: add support for Immersive Audio Model and Formats in ISOBMFFJames Almer2024-02-201-69/+288
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* all: use designated initializers for AVOption.unitAnton Khirnov2024-02-141-29/+29
| | | | | | | | | | | | | | | | | | | | | | | | Makes it robust against adding fields before it, which will be useful in following commits. Majority of the patch generated by the following Coccinelle script: @@ typedef AVOption; identifier arr_name; initializer list il; initializer list[8] il1; expression tail; @@ AVOption arr_name[] = { il, { il1, - tail + .unit = tail }, ... }; with some manual changes, as the script: * has trouble with options defined inside macros * sometimes does not handle options under an #else branch * sometimes swallows whitespace
* avformat/mov: add support for 'amve' ambient viewing environment boxDamiano Galassi2024-02-041-0/+28
| | | | | | As defined in ISOBMFF (ISO/IEC 14496-12) document. Co-Authored-By: Cosmin Stejerean <cosmin@cosmin.at>
* avformat/mov: rename rescale_mdcvCosmin Stejerean2024-02-041-11/+11
| | | | | | It's not specific to the mdcv box. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mp4: add muxer support for H266/VVCThomas Siedel2024-01-311-1/+39
| | | | | | | | | | | | | | | | | Add muxer for vvcc byte stream format. Add AV_CODEC_ID_VVC to ff_mp4_obj_type. Add AV_CODEC_ID_VVC to ISO Media codec (VvcConfigurationBox vvi1, vvc1 defined in ISO/IEC 14496-15:2021). Add VvcConfigurationBox vvcC which extends FullBox type in ISO/IEC 14496-15:2021. Tested with: ffmpeg -i NovosobornayaSquare_1920x1080.mp4 -c:v libvvenc test.mp4 && ffmpeg -i test.mp4 -f null - ffmpeg -i NovosobornayaSquare_1920x1080.mp4 -c:v copy test.mp4 && ffmpeg -i test.mp4 -f md5 - Signed-off-by: James Almer <jamrial@gmail.com> Signed-off-by: Thomas Siedel <thomas.ff@spin-digital.com> Co-Authored-By: Nuo Mi <nuomi2021@gmail.com>
* Revert "all: Don't set AVClass.item_name to its default value"Anton Khirnov2024-01-201-0/+2
| | | | | | | Some callers assume that item_name is always set, so this may be considered an API break. This reverts commit 0c6203c97a99f69dbaa6e4011d48c331e1111f5e.
* lavf/movenc: sort options by nameStefano Sabatini2024-01-101-43/+43
|
* all: Don't set AVClass.item_name to its default valueAndreas Rheinhardt2023-12-221-2/+0
| | | | | | | | Unnecessary since acf63d5350adeae551d412db699f8ca03f7e76b9; also avoids relocations. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/movenc: rename MOVMuxContext.nb_streams to nb_tracksJames Almer2023-12-121-41/+41
| | | | | | It's more appropiate given what it keeps a count of. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/avformat: use the side data from AVStream.codecparJames Almer2023-10-061-41/+53
| | | | | | | | | | | | Deprecate AVStream.side_data and its helpers in favor of the AVStream's codecpar.coded_side_data. This will considerably simplify the propagation of global side data to decoders and from encoders. Instead of having to do it inside packets, it will be available during init(). Global and frame specific side data will therefore be distinct. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/avformat: Deprecate AVFMT_ALLOW_FLUSHAndreas Rheinhardt2023-10-031-0/+45
| | | | | | | | | | | | | | | It is of no value to the user, because every muxer can always be flushed with a NULL packet. As its documentation shows ("If not set, the muxer will not receive a NULL packet in the write_packet function") it is actually an internal flag that has been publically exposed because there was no internal flags field for output formats for a long time. But now there is and so use it by replacing the public flag with a private one. Reviewed-by: James Almer <jamrial@gmail.com> Reviewed-by: Anton Khirnov <anton@khirnov.net> Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavf/movenc: enable dvh1 FourCCDamiano Galassi2023-09-201-0/+1
| | | | | | | | | | | | | This is required to pass through Dolby Vision metadata to x265. Profiles 5 and 8 require the "dvh1" fourCC: https://professional.dolby.com/siteassets/content-creation/dolby-vision-for-content-creators/dolby-vision-streams-within-the-http-live-streaming-format-v2.0-13-november-2018.pdf#unique_10 https://professional.dolby.com/siteassets/content-creation/dolby-vision-for-content-creators/dolbyvisioninmpegdashspecification_v2_0_public_20190107.pdf#unique_13 https://professional.dolby.com/siteassets/content-creation/dolby-vision-for-content-creators/dolby_vision_bitstreams_within_the_iso_base_media_file_format_dec2017.pdf See also https://github.com/HandBrake/HandBrake/pull/4838 for more details. Fixes: https://trac.ffmpeg.org/ticket/10257
* avcodec/defs: Add AV_PROFILE_* defines, deprecate FF_PROFILE_* definesAndreas Rheinhardt2023-09-071-4/+4
| | | | | | | | | These defines are also used in other contexts than just AVCodecContext ones, e.g. in libavformat. Furthermore, given that these defines are public, the AV-prefix is the right one, so deprecate (and not just move) the FF-macros. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/vpcc: fix VP9 metadata in FLV and RTMPAlessandro Ros2023-09-041-3/+0
| | | | | | | | | | | | | | In order to send VP9 tracks with FLV or RTMP, the enhanced RTMP specification tells that VPCodecConfigurationRecord, a.k.a. vpcC ISO-BMFF box, must be inserted into a metadata message. However, the function responsible for generating vpcCs currently returns invalid boxes, that are lacking the Version and Flag fields, inherited from FullBox. For some reason, both flags were being added manually in movenc. This patch fixes the issue. Signed-off-by: Alessandro Ros <aler9.dev@gmail.com> Reviewed-by: Steven Liu <lingjiujianke@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/movenc: fix sample size being zero in pcmCZhao Zhili2023-08-061-1/+6
| | | | | | | | bits_per_raw_sample might not set when remux raw PCM. Fix #10433. Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* avformat/mov_muxer: Extended MOV muxer to handle EVC video contentDawid Kozinski2023-06-151-0/+33
| | | | | | | - Changes in mov_write_video_tag function to handle EVC elementary stream - Provided structure EVCDecoderConfigurationRecord that specifies the decoder configuration information for ISO/IEC 23094-1 video content Signed-off-by: Dawid Kozinski <d.kozinski@samsung.com>
* avformat/movenc: factorize determining mdhd/mvhd/tkhd versionMarton Balint2023-04-241-9/+12
| | | | | | | Also make duration check for mvhd more consistent with the others, write version 1 of mvhd if duration is at least INT32_MAX instead of UINT32_MAX. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/movenc: fixed fmp4 packets containing incorrect flags after transcodingWang Yaqiang2023-04-241-2/+2
| | | | | | | | | | | | When write multi-trun box, the MOV_TRUN_FIRST_SAMPLE_FLAGS flag need judge by first param, not 0. If the original video contains consecutive I frames, this will cause the packets of fmp4 have error sample_flags , and then incorrect keyframes were generated, and then error packet will be seeked. Signed-off-by: Wang Yaqiang <wangyaqiang03@kuaishou.com> Signed-off-by: Steven Liu <liuqi05@chinaffmpeg.org>
* avformat/movenc: correct loci parameter handlingGyan Doshi2023-04-031-3/+3
| | | | | | | | | | 3GPP TS 26.244 Table 8.10 specifies that longitude is written before latitude. The MOV demuxer already expects the correct order. So, write them in that order. However, the user supplied string may also be used in MOV mode which requires ISO 6709 format which specifies latitude first. The demuxer also exports the loci value in that format. So parser adjusted as well.
* avformat/mov: fix 2 compile errorsTong Wu2023-03-161-1/+1
| | | | | | | | | | | Compiler: MSVC 14.35.32215 Error type: error C2059: syntax error: '}' Related commit: 9e1ffed fate/mov: add PCM in mp4 test d7e8643 avformat/mov: parse ISO-14496-12 ChannelLayout Signed-off-by: Tong Wu <tong1.wu@intel.com> Signed-off-by: Zhao Zhili <zhilizhao@tencent.com> Reviewed-by: Haihao Xiang <haihao.xiang@intel.com>
* avformat/movenc: add PCM in mp4 supportZhao Zhili2023-03-151-1/+83
| | | | | | | | It's defined by ISO/IEC 23003-5. Fixes ticket #10185 Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* avformat/movenc: allow writing out channel count in MP4 and 3GPJan Ekström2023-02-141-7/+1
| | | | | | | | | | | | | | | | | | | ISOBMFF (14496-12) made this field ('channelcount') in the AudioSampleEntry structure non-template¹ somewhere before the release of the 2022 edition. As for ETSI TS 126 244 AKA 3GPP file format (V16.1.0, 2020-10), it does not seem contain any references limiting the channelcount entry in AudioSampleEntry or in its own definition of EVSSampleEntry. fate-mov-mp4-chapters test had to be adjusted as it output a mono vorbis stream, which would now be properly marked as such in the container. 1: As per 14496-12: Fields shown as “template” in the box descriptions are fields which are coded with a default value unless a derived specification defines their use and permits writers to use other values than the default.
* avutil/{color_utils, csp}: merge color_utils into csp and expose APILeo Izen2023-02-091-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | libavutil/color_utils contains some avpriv_ symbols that map enum AVTransferCharacteristic values to gamma-curve approximations and to the actual transfer functions to invert them (i.e. -> linear). There's two issues with this: (1) avpriv is evil and should be avoided whenever possible (2) libavutil/csp.h exposes a public API for handling color that already handles primaries and matricies I don't see any reason this API has to be private, so this commit takes the functionality from avutil/color_utils and merges it into avutil/csp with an exposed av_ API rather than the previous avpriv_ API. Every reference to the previous API has been updated to point to the new one. color_utils.h has been deleted as well. This should not break any applications as it only contained avpriv_ symbols in the first place, so nothing in that header could be referenced by other applications. Signed-off-by: Leo Izen <leo.izen@gmail.com> Signed-off-by: Anton Khirnov <anton@khirnov.net>
* avformat/avformat: Move AVOutputFormat internals out of public headerAndreas Rheinhardt2023-02-091-85/+85
| | | | | | | | | | | | | | This commit does for AVOutputFormat what commit 20f972701806be20a77f808db332d9489343bb78 did for AVCodec: It adds a new type FFOutputFormat, moves all the internals of AVOutputFormat to it and adds a now reduced AVOutputFormat as first member. This does not affect/improve extensibility of both public or private fields for muxers (it is still a mess due to lavd). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: Anton Khirnov <anton@khirnov.net>
* avformat/movenc: Add loop parameter to animated AVIFVignesh Venkatasubramanian2023-01-131-4/+31
| | | | | | | | | | | | | | | | | | | | | | | The HEIF specification permits specifying the looping behavior of animated sequences by using the EditList (elst) box. The track duration will be set to the total duration of all the loops (or infinite) and the duration of a single loop will be set in the edit list box. The default behavior is to loop infinitely. Compliance verification: * This was added in libavif recently [1] and the files produced by ffmpeg after this change have EditList boxes similar to the ones produced by libavif (and avifdec is able to parse the loop count as intended). * ComplianceWarden is ok with the produced files. * Chrome is able to play back the produced files. [1] https://github.com/AOMediaCodec/libavif/commit/4d2776a3af53ae1aefdaed463b75ba12fd9cf8c2 Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com> Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* avformat/movenc: Add movie_timescale option to AVIFVignesh Venkatasubramanian2023-01-131-0/+6
| | | | | | | | | | | | | Allow specifying the movie_timescale options to AVIF ouptut. This also makes sure that when movie_timescale is not specified, the default value of 1000 is used instead of 0. Animated AVIF files which don't specify the movie_timescale will have the correct duration written in the track and movie headers after this change (instead of writing 0). Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com> Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* avformat/movenc: correct write_colr warning placementGyan Doshi2022-12-151-2/+3
| | | | | | | | The old warning is no longer applicable in the inner block after c5b20cfe19. Reviewed-by: Zhao Zhili <quinkblack@foxmail.com> Signed-off-by: Gyan Doshi <ffmpeg@gyani.pro>
* avformat/movenc: use av_dict_iterateMarvin Scholz2022-12-011-4/+4
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/vpcc: parse bitstream data to get profile and bitdepthJames Almer2022-11-171-1/+3
| | | | | | | | Profile can be derived from values codecpar pixel format only with software formats. For hardware formats, we're forced to parse a frame header to get the required information. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/movenc: Write auxi box for animated AVIF with alphaVignesh Venkatasubramanian2022-09-221-12/+15
| | | | | | | | | | | | | According to the HEIF specification (ISO/IEC 23008-12) Section 7.5.3.1, tracks with handler_type 'auxv' must contain a 'auxi' box in its SampleEntry to notify the nature of the auxiliary track to the decoder. The content is the same as the 'auxC' box. So parameterize and re-use the existing function. Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com> Signed-off-by: James Zern <jzern@google.com>
* avformat/movenc: Remove experimental status of flac-in-MP4 muxingMartijn van Beurden2022-08-081-1/+1
| | | | | | | | | | | | | The fLaC and dfLa box IDs have been registered with the MP4 RA (they are now listed at https://mp4ra.org/#/codecs) and support for muxing FLAC in MP4 has been experimental in ffmpeg for 6 years now, since Nov 21, 2016 This patch removes the experimental status and removes the MP4 object type, as none has been registered for FLAC as it was not deemed necessary. Signed-off-by: Anton Khirnov <anton@khirnov.net>
* avformat/movenc: Ensure packet is writable before modifying itAndreas Rheinhardt2022-07-091-0/+3
| | | | | | | | Fixes e.g. ffmpeg -i fate-suite/h264/bbc2.sample.h264 -c:v rawvideo -map 0:v -frames:v 10 -pix_fmt gray8 -f tee "first.mov|second.mov" Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/movenc: Fix invalid checkAndreas Rheinhardt2022-06-301-1/+1
| | | | | | | | Regression since c9de096851803d45444ae9dfe3a390a2d53ac71b. Fixes Coverity ID 1506839. Reviewed-by: Jan Ekström <jeebjp@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/movenc: limit ISOBMFF AC-3 mapping to bsids <=8Jan Ekström2022-06-301-0/+8
| | | | | | | | | | This leaves out RealAudio DolbyNet, which utilizes bsids 9 and 10, It is not clear whether the interpreted bit rate value (divided by 2 or 4 depending on the variant), or the original bit rate value should be utilized to receive the bit_rate_code index. Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
* avformat/movenc: handle OOM situations when parsing AC-3 headersJan Ekström2022-06-301-1/+4
| | | | Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
* avformat/movenc: utilize existing AC-3 parsing workflow for AC-3Jan Ekström2022-06-301-28/+18
| | | | Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
* avformat/movenc: move eac3_info definition so that it can be used for AC-3Jan Ekström2022-06-301-33/+33
| | | | Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
* avformat/movenc: enable handle_eac3 to handle AC-3 tracksJan Ekström2022-06-301-3/+19
| | | | | | | | | | | Add the AC-3 frame type, as well as early exit from additional packet parsing in case of AC-3, as only a single packet is required to get the required information. Additionally, expose ac3_bit_rate_code via the eac3_info struct as it is required for AC3SpecificBox. Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
* {configure,avformat/movenc}: enable AC-3 parser for movencJan Ekström2022-06-301-4/+0
| | | | | | | | | | | | This simplifies the code to no longer have #ifs in a manner which does not require handling avpriv_ac3_parse_header returning ENOSYS. As an existing example, the MPEG-TS muxer already requires the AC-3 parser, and in order to fix existing issues with the current AC-3 movenc code, switching to use the AC-3 parser is required, so this is an enabling change for that. Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
* avformat/movenc: Support alpha channel for AVIFVignesh Venkatasubramanian2022-06-271-60/+128
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AVIF specification allows for alpha channel as an auxiliary item (in case of still images) or as an auxiliary track (in case of animated images). Add support for both of these. The AVIF muxer will take exactly two streams (when alpha is present) as input (first one being the YUV planes and the second one being the alpha plane). The input has to come from two different images (one of it color and the other one being alpha), or it can come from a single file source with the alpha channel extracted using the "alphaextract" filter. Example using alphaextract: ffmpeg -i rgba.png -filter_complex "[0:v]alphaextract[a]" -map 0 -map "[a]" -still-picture 1 avif_with_alpha.avif Example using two sources (first source can be in any pixel format and the second source has to be in monochrome grey pixel format): ffmpeg -i color.avif -i grey.avif -map 0 -map 1 -c copy avif_with_alpha.avif The generated files pass the compliance checks in Compliance Warden: https://github.com/gpac/ComplianceWarden libavif (the reference avif library) is able to decode the files generated using this patch. They also play back properly (with transparent background) in: 1) Chrome 2) Firefox (only still AVIF, no animation support) Reviewed-by: James Zern <jzern@google.com> Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
* avformat/movenc: enable compressorname for mp4 modeZhao Zhili2022-06-241-2/+3
| | | | Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* avformat/mov: refactor to use avutil/uuidPierre-Anthony Lemieux2022-06-121-4/+5
|
* avformat/movenc: Add support for AVIF muxingVignesh Venkatasubramanian2022-05-131-25/+316
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add an AVIF muxer by re-using the existing the mov/mp4 muxer. AVIF Specification: https://aomediacodec.github.io/av1-avif Sample usage for still image: ffmpeg -i image.png -c:v libaom-av1 -still-picture 1 image.avif Sample usage for animated AVIF image: ffmpeg -i video.mp4 animated.avif We can re-use any of the AV1 encoding options that will make sense for image encoding (like bitrate, tiles, encoding speed, etc). The files generated by this muxer has been verified to be valid AVIF files by the following: 1) Displays on Chrome (both still and animated images). 2) Displays on Firefox (only still images, firefox does not support animated AVIF yet). 3) Verified to be valid by Compliance Warden: https://github.com/gpac/ComplianceWarden Fixes the encoder/muxer part of Trac Ticket #7621 Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
* avformat/av1: Add a parameter to av1c to omit seq headerVignesh Venkatasubramanian2022-05-131-1/+1
| | | | | | | | | Add a parameter to omit seq header when generating the av1C atom. For now, this does not change any behavior. This will be used by a follow-up patch to add AVIF support. Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
* avformat/utils: Move ff_get_packet_palette() to rawutils.cAndreas Rheinhardt2022-05-101-0/+1
| | | | | | | | | | ff_get_packet_palette() and ff_reshuffle_raw_rgb() belong together: E.g. the former takes the return value of the latter as argument. So move ff_get_packet_palette() to rawutils.c (which consists solely of ff_reshuffle_raw_rgb()). Also add a separate header for these two functions. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/internal: Move muxing-only functions to new mux.h headerAndreas Rheinhardt2022-05-101-0/+1
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>