aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/movenc.c
Commit message (Collapse)AuthorAgeFilesLines
* avformat/movenc: Fix editlist with hybrid_fragmentedZhao Zhili2025-06-161-2/+7
| | | | | | | | | The segment_duration must not be set to zero when writing the moov atom for the second time. This is related to edit lists in standard MP4 files. Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* avformat/movenc: handle EAC-3 extension bits for Atmosnyanmisaka2025-06-081-1/+10
| | | | | | | | Based on a patch by nyanmisaka. Fixes commit #9996. Reviewed-by: Baptiste Coudurier <baptiste.coudurier@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/ac3_parser: handle more header bits in ff_ac3_parse_header()James Almer2025-06-081-15/+2
| | | | | | Based on a patch by nyanmisaka. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/movenc: fix writing reserved bits in EC3SpecificBoxJames Almer2025-06-051-2/+2
| | | | | | | | As described in section F.6.1 from ETSI TS 102 366. Found-by: nyanmisaka Reviewed-by: Baptiste Coudurier <baptiste.coudurier@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/movenc: Reduce loop iterations in mov_flush_fragmentZhao Zhili2025-06-011-1/+1
| | | | Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* avformat/movenc: Fix flush fragmentZhao Zhili2025-06-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | The follow cmd output corrupted file before the patch: ffmpeg -f lavfi -i color=blue,trim=duration=0.04 \ -f lavfi -i anullsrc,atrim=duration=2 \ -movflags +empty_moov+hybrid_fragmented \ -frag_duration 1000000 \ -frag_interleave 1 \ output.mp4 1. first_track is the first track with track->entry != 0. As in the command above, video track (track index 0) has a single frame. When flush the second fragment, first_track is 1, the audio track. 2. write_moof = i == first_track, so write_moof is false for i = 0. 3. When mov->frag_interleave != 0, mov->mdat_buf != NULL, because it contains audio data. So avio_write is called before write_moof, that is, the data write before moof, and mov_finish_fragment executed with wrong mdat_start. 4. With normal fmp4 output, the error isn't obvious. With hybrid_fragmented, ffplay output.mp4 shows a lot of error messages. Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* avformat/movenc: fix VVC encoding with leading picturesGabriel Hege2025-05-311-2/+2
| | | | | | | | | | | | The default behavior for VVenC (since v1.10.0) is to create an IDR with leading pictures for the first picture in decoding order (POC 32). This leads to FFmpeg generating an edit list with an empty entry, skipping the leading pictures. This patch fixes the calculation for the start_pts, while the DTS is negative (as produced by vvenc). Signed-off-by: Gabriel Hege <g+ffmpeg@hege.cc>
* avformat/movenc: disallow buggy flags combinationGyan Doshi2025-05-261-0/+6
| | | | | Use of hybrid_fragmented and faststart together can result in files with loss of sync and bitstream parsing errors upon playback.
* avformat/movenc: fix setting elst/stss for IAMF with OpusFelicia Lim2025-04-141-0/+9
|
* avformat: remove deprecated FF_API_ALLOW_FLUSHJames Almer2025-03-281-38/+2
| | | | | | Deprecated since 2023-10-02. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/movenccenc: add support for CENC AV1 encryptionJames Almer2025-03-251-3/+10
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/movenc: Add AVS3 supportZhao Zhili2025-03-041-0/+36
| | | | | | | | 'avs3' is registered at mp4ra.org. The Avs3ConfigurationBox 'av3c' inside 'avs3' hasn't been registered yet, but is specified by the AVS3 spec. Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* avformat/hevc: add a log context to ff_isom_write_{hvcc,lhvc}James Almer2024-12-081-8/+8
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/movenc: log stream index for invalid pkt durationGyan Doshi2024-12-071-3/+3
|
* avformat/mov: add support for pssh boxMalek Assaad2024-12-051-2/+46
| | | | | | | * Enable PSSH box writing to mov & moof. * Enable senc, saio & saiz writing to moof when writing fragments. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/movenc: write stss boxes for xHE-AACJames Almer2024-11-241-0/+1
| | | | | | This is in preparation for a following change. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/movenc: don't disable edit lists when writing CMAF outputJames Almer2024-11-221-8/+0
| | | | | | | | | They are needed for audio tracks with priming samples, where negative CTS offsets can't be used. Fixes ticket #11031. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mov: rename MOVCtts.duration to offsetJames Almer2024-11-221-4/+4
| | | | | | The value is a timestamp offset, not a duration. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/movenc: don't write a calculated avgBitrate when the provided one ↵James Almer2024-11-221-0/+3
| | | | | | | | | | | is unset avgBitrate == 0 is used to signal a VBR track, so if that value is propagated by an encoder, don't overwrite it with a calculated value based on track size. Part of a fix for ticket #11303. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/movenc: don't write PS NALUs in hvcC for codec tag hvc1James Almer2024-11-221-2/+3
| | | | | | array_completeness shall be 1 for those tracks. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/movenc: Fix ffv1 supportMichael Niedermayer2024-11-161-0/+1
| | | | | | Fixes: Ticket9975 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/movenc: explicitly support V30XLE and not the host native endian ↵James Almer2024-10-171-1/+1
| | | | | | | | version Should fix fate-vsynth*-v410 on BE targets. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec: deprecate v410 de/encoderJames Almer2024-10-121-1/+1
| | | | | | | The V30X pixel format was recently added, so this lavc workaround is no longer needed. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec: deprecate v308 de/encoderJames Almer2024-10-121-1/+1
| | | | | | | The vyu444 pixel format was recently added, so this lavc workaround is no longer needed. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec: deprecate v408 de/encoderJames Almer2024-10-121-0/+2
| | | | | | | The uyva pixel format was recently added, so this lavc workaround is no longer needed. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/movenc: add support for V30X pixel formatJames Almer2024-10-121-0/+2
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/movenc: add support for VYU444 pixel formatJames Almer2024-10-121-0/+2
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/movenc: add support for UYVA pixel formatJames Almer2024-10-121-0/+2
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/movenc: don't look at previous track_id as it may not be setJames Almer2024-08-121-1/+1
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/movenc: use stream indexes when generating track idsJames Almer2024-08-071-1/+5
| | | | | | | | | | | In some scenarios nb_tracks isn't the same as nb_streams, so a given id may end up being used for two separate streams. e.g. when muxing an IAMF track followed by a video track, if the IAMF track consists of several streams, the video track would end up having an id of 2, which may also be used by one of the IAMF streams. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mov: fix track handling when mixing IAMF and video tracksJames Almer2024-08-041-9/+28
| | | | | | Fixes crashes when muxing the two together. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/movenc: fix channel count and samplerate fields for IAMF tracksFelicia Lim2024-07-181-3/+7
| | | | | | | | Clause 6.2.3 of IAMF[1] states both of these shall be set to 0. [1]https://aomediacodec.github.io/iamf/v1.0.0-errata.html#iasampleentry-section Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/movenc: support writing cropping valuesJames Almer2024-07-111-14/+42
| | | | | | Finishes implementing ticket #7437. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/movenc: add support for writting hfov boxesJames Almer2024-07-071-0/+13
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/movenc: add support for writting vexu boxesJames Almer2024-07-071-5/+154
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/movenc: add support for writing lhvC boxesJames Almer2024-07-071-2/+27
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* lavf/movenc: mark mov/mp4 as supporting VFRAnton Khirnov2024-07-071-6/+6
|
* movenc: Add an option for resilient, hybrid fragmented/non-fragmented muxingMartin Storsjö2024-06-241-5/+57
| | | | | | | | | | | | | | This allows ending up with a normal, non-fragmented file when the file is finished, while keeping the file readable if writing is aborted abruptly at any point. (Normally when writing a mov/mp4 file, the unfinished file is completely useless unless it is finished properly.) This results in a file where the mdat atom contains (and hides) all the moof atoms that were part of the fragmented file structure initially. Signed-off-by: Martin Storsjö <martin@martin.st>
* movenc: Factorize a function for finishing a written fragmentMartin Storsjö2024-06-241-7/+13
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* avformat: split off generic NAL function helpers into their own fileJames Almer2024-06-201-2/+3
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/movenc: add support for writing SA3D boxesJames Almer2024-05-231-0/+63
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/movenc: Avoid loop for writing arrayAndreas Rheinhardt2024-05-041-2/+1
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/movenc: Check av_malloc()Andreas Rheinhardt2024-05-041-0/+2
| | | | | | | Fixes Coverity issue #1596735. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/movenc: remove one level of indentationJames Almer2024-04-231-31/+26
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/movenc: warn if dovi cfg ignoredNiklas Haas2024-04-221-5/+10
| | | | | | Since this is guarded behind strict unofficial, we should warn if the user feeds a dolby vision stream to this muxer, as it will otherwise result in a broken file.
* movenc: Allow writing timed ID3 metadataMartin Storsjö2024-04-101-1/+48
| | | | | | | | | | | | | This is based on a spec at https://aomediacodec.github.io/id3-emsg/, further based on ISO/IEC 23009-1:2019. Within libavformat, timed ID3 metadata (already supported by the mpegts demuxer and muxer) is handled as a separate data AVStream with codec type AV_CODEC_ID_TIMED_ID3. However, it doesn't have a corresponding track in the mov file - instead, these events are written as separate toplevel 'emsg' boxes. Signed-off-by: Martin Storsjö <martin@martin.st>
* movenc: Remove a leftover commented out lineMartin Storsjö2024-04-101-2/+0
| | | | | | This line originates from 6f69f7a8bf6a0d013985578df2ef42ee6b1c7994. Signed-off-by: Martin Storsjö <martin@martin.st>
* configure: Separate subsystem for Immersive Audio ModelEugene Zemtsov2024-04-031-0/+18
| | | | | | | | | | This change allows users to build libavfomat without support for Immersive Audio Model by specifying --disable-iamf. It helps to save on binary size in cases where it's important. Co-authored-by: James Almer <jamrial@gmail.com> Signed-off-by: Eugene Zemtsov <eugene@chromium.org> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/movenc: Check that cts fits in 32bitMichael Niedermayer2024-04-011-0/+6
| | | | | | | | Fixes: Assertion av_rescale_rnd(start_dts, mov->movie_timescale, track->timescale, AV_ROUND_DOWN) <= 0 failed at libavformat/movenc.c:3694 Fixes: poc2 Found-by: Wang Dawei and Zhou Geng, from Zhongguancun Laboratory Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avutil/common: Don't auto-include mem.hAndreas Rheinhardt2024-03-311-2/+1
| | | | | | | | | | | There are lots of files that don't need it: The number of object files that actually need it went down from 2011 to 884 here. Keep it for external users in order to not cause breakages. Also improve the other headers a bit while just at it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>