summaryrefslogtreecommitdiff
path: root/fftools
Commit message (Collapse)AuthorAge
* fftools/cmdutils: Fix undefined 1 << 31Andreas Rheinhardt2022-01-11
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* ffmpeg: remove a redundant assignment of interrupt_callbackAnton Khirnov2022-01-10
| | | | It is already set in open_output_file().
* ffprobe: Support AV_FRAME_DATA_DOVI_METADATAJan Ekström2022-01-04
| | | | | Co-authored-by: Niklas Haas <git@haasn.dev> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools: provide media type info for devicesDiederick Niehorster2021-12-24
| | | | | | | | fftools now print info about what media type(s), if any, are provided by sink and source avdevices. Signed-off-by: Diederick Niehorster <dcnieho@gmail.com> Reviewed-by: Roger Pack <rogerdpack2@gmail.com>
* fftools/ffmpeg_filter: Avoid inserting hflip filterAndreas Rheinhardt2021-12-23
| | | | | | | The transpose filter has modes equivalent to "rotation by 90°/270°" followed by horizontal flips. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/ffmpeg_filter: Fix autorotationAndreas Rheinhardt2021-12-23
| | | | | | | | | | | | | | | | | | | | | | | | | | In case of an orthogonal transformation av_display_rotation_get() returns the (anticlockwise) degree that the unit vector in x-direction gets rotated by; get_rotation in cmdutils.c makes a clockwise degree out of this. So if one inserts a transpose filter corresponding to this degree, then the x-vector gets mapped correctly and there are two possibilities for image of the y-vector, namely the two unit vectors orthogonal to the image of the x-vector. E.g. if the x-vector gets rotated by 90° clockwise, then the two possibilities for the y-vector are the unit vector in x direction or its opposite. The latter case is a simple 90° rotation for both vectors* whereas the former is a simple 90° clockwise rotation followed by a horizontal flip. These two cases can be distinguished by looking at the x-coordinate of the image of the y-vector, i.e. by looking at displaymatrix[3]. Similarly for the case of a 270° clockwise rotation. These two cases were previously wrong (they were made to match wrongly parsed exif rotation tag values). *: For display matrices, the y-axis points downward. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* ffprobe: add missing separator when printing side data in compact outputJames Almer2021-12-22
| | | | | | Should fix ticket #7153 Signed-off-by: James Almer <jamrial@gmail.com>
* fftools/cmdutils: Avoid crash when opts could not be allocatedYu Yang2021-12-16
| | | | | | | | If 'opts' could not be allocated, exiting the program to avoid crash when release it. Reported-by: TOTE Robot <oslab@tsinghua.edu.cn> Signed-off-by: Yu Yang <yuyang14@kuaishou.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/ffmpeg: close output files before cleanupMarton Balint2021-12-12
| | | | | | This allows us to check the return value of avio_closep(). Signed-off-by: Marton Balint <cus@passwd.hu>
* ffmpeg: handle errors in print_sdp()Anton Khirnov2021-12-07
| | | | Do not continue as if nothing happened.
* ffmpeg: move setting video sync method to new_video_stream()Anton Khirnov2021-12-07
| | | | | | do_video_out() is the wrong place for it, since the necessary information is already known when creating the stream and its value should never change.
* ffmpeg: deprecate passing numbers to -vsyncAnton Khirnov2021-12-07
| | | | | There is never a reason to do this, using symbolic names is always preferred.
* ffmpeg: change vsync value to an enumAnton Khirnov2021-12-07
| | | | | Stop explicitly defining VSCFR and DROP values, which were never documented.
* ffmpeg: drop useless framerate assignmentsAnton Khirnov2021-12-07
| | | | | | If the input stream framerate is known, it will be configured on the relevant filtergraph input and get propagated to the output stream in the above line. That makes these assignments redundant.
* fftools/ffmpeg_opt: Improve alloc/truncation checks when reading linesAndreas Rheinhardt2021-12-07
| | | | | | | | Do this by switching from the dynamic buffer API to the AVBPrint API; the former has no defined way to check for errors. This also avoids allocating an AVIOContext. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/ffmpeg_opt: Improve checks for truncation/alloc errorAndreas Rheinhardt2021-12-07
| | | | | | | | Do this by switching from the dynamic buffer API to the AVBPrint API; the former has no defined way to check for errors. This also avoids allocating an AVIOContext. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/ffmpeg: Avoid creating unnecessary referenceAndreas Rheinhardt2021-12-05
| | | | | | | The only caller of do_video_out() doesn't need the frame afterwards, ergo one can replace an av_frame_ref() by av_frame_move_ref(). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/ffmpeg: Avoid allocating+freeing frame, check allocationsAndreas Rheinhardt2021-12-05
| | | | | | Fixes a potential crash upon av_frame_alloc() failure. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/cmdutils: Use av_dynarray_add_nofree()Andreas Rheinhardt2021-12-05
| | | | | | | Simplifies code and reduces the number of allocations a bit by overallocating. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/cmdutils: Make allocate_array_elem() return ptr to new elementAndreas Rheinhardt2021-12-05
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/ffmpeg_(filter|opt): Use dedicated pointer for array elem accessAndreas Rheinhardt2021-12-05
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/cmdutils: Atomically add elements to list of pointers, fix crashAndreas Rheinhardt2021-12-05
| | | | | | | | | | | | | | Currently, adding a (separately allocated) element to a list of pointers works by first reallocating the array of pointers and (on success) incrementing its size and only then allocating the new element. If the latter allocation fails, the size is inconsistent, i.e. array[nb_array_elems - 1] is NULL. Our cleanup code crashes in such scenarios. Fix this by adding an auxiliary function that atomically allocates and adds a new element to a list of pointers. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* ffmpeg: only copy bits_per_sample from decoder when it remains validAnton Khirnov2021-12-04
| | | | | I.e. when the only filters that are applied do not modify the frame data.
* ffmpeg: make -bits_per_raw_sample a per-output-stream optionAnton Khirnov2021-12-04
| | | | Also, document it and make it apply to audio in addition to video.
* fftools/ffmpeg_filter: Avoid DynBuf API to improve error checksAndreas Rheinhardt2021-12-03
| | | | | | | | | | | | | | | | | choose_pix_fmts() used the dynamic buffer API to write strings; as is common among uses of this API, only opening the dynamic buffer was checked, but not the end result, leading to crashes in case of allocation failure. Furthermore, some static strings were duplicated; the allocations performed here were not properly checked: Allocation failure would be treated as "could not determine pixel format". The first issue is fixed by switching to the AVBPrint API which allows to easily perform checks at the end. Furthermore, the internal buffer avoids almost all allocations in case the AVBPrint is used. The AVBPrint also allows to solve the second issue in an elegant way, because it allows to return the static strings directly. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/ffmpeg_filter: Avoid DynBuf-API for writing stringsAndreas Rheinhardt2021-12-03
| | | | | | | | It is not really natural, it requires internal allocations of its own and its error handling is horrible (i.e. the implicit (re)allocations here are unchecked). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* ffmpeg: fix usage of -shortest in codec copy scenariosJames Almer2021-12-01
| | | | | | | | | Don't mark all streams as finished, instead make sync_opts keep track of the stream's duration, and set recording_time to it, same as in transcoding paths. Fixes tickets #9512 and #9513. Signed-off-by: James Almer <jamrial@gmail.com>
* fftools/ffmpeg_opt: Don't set source_index redundantlyAndreas Rheinhardt2021-11-30
| | | | | | It is already set in new_output_stream(). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/ffmpeg_opt: Don't duplicate array unnecessarilyAndreas Rheinhardt2021-11-30
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/ffprobe: print size of attachment streams (extradata_size)softworkz2021-11-29
| | | | | Signed-off-by: softworkz <softworkz@hotmail.com> Signed-off-by: Marton Balint <cus@passwd.hu>
* ffmpeg: remove ffmpeg_videotoolboxrcombs2021-11-28
| | | | | | This was almost completely redundant. The only functionality that's no longer available after this removal is the videotoolbox_pixfmt arg, which has been obsolete for several years.
* fftools/ffmpeg: Take type limitations of AVFifo API into accountAndreas Rheinhardt2021-11-26
| | | | | | | | | | | | The types used by the AVFifo API are inconsistent: av_fifo_(space|size)() returns an int; av_fifo_alloc() takes an unsigned, other parts use size_t. This commit therefore ensures that the size of the muxing_queue FIFO never exceeds INT_MAX. While just at it, also make sure not to call av_fifo_size() unnecessarily often. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* ffmpeg: drop obsolete rotation API remnantsAnton Khirnov2021-11-23
| | | | No demuxers export the "rotate" metadata tag anymore.
* ffmpeg: drop -isync, which did nothing since 2012Anton Khirnov2021-11-23
|
* ffmpeg: drop -sameq/-samequant optionsAnton Khirnov2021-11-23
| | | | They did nothing but return an error since 2012.
* ffmpeg: drop the -tvstd optionAnton Khirnov2021-11-23
| | | | It is undocumented and has been deprecated since 2012.
* ffmpeg: drop the -vc optionAnton Khirnov2021-11-23
| | | | It is undocumented and has been deprecated since 2012.
* ffmpeg: drop the -deinterlace optionAnton Khirnov2021-11-23
| | | | It is undocumented and has been deprecated since 2013.
* ffmpeg: drop the -intra optionAnton Khirnov2021-11-23
| | | | It is undocumented and has been marked as deprecated since 2012.
* ffmpeg: do not copy chroma_sample_location from the input streamAnton Khirnov2021-11-23
| | | | It will be set from the supplied AVFrame later on.
* fftools/ffmpeg: Avoid temporary frameAndreas Rheinhardt2021-11-20
| | | | | | | | | | | | | | | send_frame_to_filters() sends a frame to all the filters that need said frame; for every filter except the last one this involves creating a reference to the frame, because av_buffersrc_add_frame_flags() by default takes ownership of the supplied references. Yet said function has a flag which changes its behaviour to create a reference itself. This commit uses this flag and stops creating the references itself; this allows to remove the spare AVFrame holding the temporary references; it also avoids unreferencing said frame. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* ffmpeg: remove unused hw_frames_ctx AVBufferRef from InputStreamJames Almer2021-11-19
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* ffmpeg: remove unused hwaccel_get_buffer function pointerJames Almer2021-11-19
| | | | | | | As well as the custom get_buffer2() implementation which would become a redundant wrapper for avcodec_default_get_buffer2() after this Signed-off-by: James Almer <jamrial@gmail.com>
* ffmpeg: Allocate InputStream.decoded_frame earlyJames Almer2021-11-19
| | | | | | Based on a commit by Andreas Rheinhardt. Signed-off-by: James Almer <jamrial@gmail.com>
* ffmpeg: Allocate (In|Out)putStream.filter_frame earlyJames Almer2021-11-19
| | | | | | Based on a commit by Andreas Rheinhardt. Signed-off-by: James Almer <jamrial@gmail.com>
* fftools: Constify values from av_dict_get()Chad Fraleigh2021-11-18
| | | | | | | | Treat values returned from av_dict_get() as const, since they are internal to AVDictionary. Signed-off-by: Chad Fraleigh <chadf@triularity.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* ffmpeg: fix loosing gaps between audio frame timestamps when filteringPaul B Mahol2021-11-18
|
* ffmpeg: rewrite setting the stream dispositionAnton Khirnov2021-11-16
| | | | | | | | | | | | | | | | | | | | | Currently, the code doing this is spread over several places and may behave in unexpected ways. E.g. automatic 'default' marking is only done for streams fed by complex filtergraphs. It is also applied in the order in which the output streams are initialized, which is effectively random. Move processing the dispositions at the end of open_output_file(), when we already have all the necessary information. Apply the automatic default marking only if no explicit -disposition options were supplied by the user, and apply it to the first stream of each type (excluding attached pics) when there is more than one stream of that type and no default markings were copied from the input streams. Explicitly document the new behavior. Changes the results of some tests, where the output file gets a default disposition, while it previously did not.
* cmdutils: add an option for listing stream dispositionsAnton Khirnov2021-11-16
|
* lavf: add "disposition" AVOption to AVStream AVClassAnton Khirnov2021-11-16
| | | | Use it to remove custom disposition parsing code from ffmpeg.c