summaryrefslogtreecommitdiff
path: root/fftools/ffmpeg_filter.c
Commit message (Collapse)AuthorAge
* fftools/ffmpeg_filter: drop a block commented out since 2012Anton Khirnov2022-07-28
| | | | | Since the option it relates to is deprecated, it is highly unlikely to become useful.
* fftools/ffmpeg: deprecate the -map_channel optionAnton Khirnov2022-07-28
| | | | | It is now entirely redundant with audio filters, and is in fact implemented by setting up a 'pan' filter instance.
* fftools/ffmpeg: drop the -vol optionAnton Khirnov2022-07-28
| | | | It has been deprecated in favor of the volume filter since 2012.
* fftools/ffmpeg_filter: do not pass the entire AVCodecContext to ↵Anton Khirnov2022-07-28
| | | | | | | choose_pixel_fmt() It only uses strict_std_compliance, so pass just that value. Makes it more clear what fields are accessed.
* fftools/ffmpeg_filter: remove unused function argumentAnton Khirnov2022-07-28
|
* fftools/ffmpeg: make the muxer AVFormatContext private to ffmpeg_mux.cAnton Khirnov2022-07-23
| | | | | Since the muxer will operate in a separate thread in the future, the muxer context should not be accessed from the outside.
* ffmpeg: convert to new channel layout-APIJames Almer2022-03-15
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* ffmpeg: flush delayed frames in codec copy scenariosJames Almer2022-02-28
| | | | | | | Bitstream filters inserted between the input and output were never drained, resulting in packets being lost if the bsf had any buffered. Signed-off-by: James Almer <jamrial@gmail.com>
* fftools/ffmpeg: fix (a)buffer src namesAnton Khirnov2022-02-15
|
* ffmpeg: switch to new FIFO APIAnton Khirnov2022-02-07
|
* 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>
* 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.
* 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: drop the -deinterlace optionAnton Khirnov2021-11-23
| | | | It is undocumented and has been deprecated since 2013.
* 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_filter: don't try to autorotate frames with hwaccel pixel formatsJames Almer2021-09-21
| | | | | | | | The transpose, rotate, hflip, and vflip filters don't support them. Fixes ticket #9432. Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: James Almer <jamrial@gmail.com>
* ffmpeg: take into account image flipping in the display matrixJames Almer2021-09-16
| | | | | | | This covers only standard rotations. Fixes part of ticket #6945. Signed-off-by: James Almer <jamrial@gmail.com>
* ffmpeg: use display matrix frame side data for autorotationJames Almer2021-09-16
| | | | | | | And give it priority over stream side data when present. Fixes part of ticket #6945. Signed-off-by: James Almer <jamrial@gmail.com>
* ffmpeg: let AVFilterGraph parse the filter_threads optionJames Almer2021-09-04
| | | | | | | | | This way the CLI accepts for "filter_threads" the same values as for the libavcodec specific option "threads". Fixes FATE with THREADS=auto which was broken in bdc1bdf3f5. Signed-off-by: James Almer <jamrial@gmail.com>
* fftools: Remove remnants of resample_optsAndreas Rheinhardt2021-09-03
| | | | | | | | | | | | | | These were intended to pass options to auto-inserted avresample resampling filters. Yet FFmpeg uses swresample for this purpose (with its own AVDictionary swr_opts similar to resample_opts). Therefore said options were not forwarded any more since commit 911417f0b34e611bf084319c5b5a4e4e630da940; moreover since commit 420cedd49745b284c35d97b936b71ff79b43bdf7 avresample options are not even recognized and ignored any more. Yet there are still remnants of all of this. This commit gets rid of them. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* Revert "fftools/ffmpeg_filter: fix the flags parsing for scaler"Linjie Fu2021-08-30
| | | | | | | | | This reverts commit b3a0548a981db52911dd34d9de254c4fee0a8f79. This breaks the usage of swscale options, scale_sws_opts should be passed to auto-inserted scale-filters. Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
* ffmpeg_filter: do not override -filter_threads with -threadsAnton Khirnov2021-08-29
| | | | | | | When both -filter_threads and -threads are specified, the latter takes effect. Since -threads is an encoder option and -filter_threads is a filter option, it makes sense for the -filter_threads to take precedence.
* ffmpeg: reset the dict iterator before useAnton Khirnov2021-08-29
|
* fftools/ffmpeg_filter: silence valgrind warningPaul B Mahol2021-08-25
|
* fftools/ffmpeg_filter: add a return at the end of non-void functionsJames Almer2021-08-06
| | | | | | Fixes compilation with GCC 11 when configured with --disable-optimizations Signed-off-by: James Almer <jamrial@gmail.com>
* fftools/ffmpeg_filter: fix the flags parsing for scalerLinjie Fu2021-08-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | Scaler relys on "-sws_flags" option to pass the flags to swscale and scale filter. Currently passing "sws_flags=xxx" as a filter option to scaler leads to an incorrect option parsing. Check and change the string to "flags=xxx" and dumped flags information. (Refer to parse_sws_flags()) CMD: $ffmpeg -v verbose -i input.mp4 -sws_flags lanczos+bitexact+accurate_rnd \ -vf format=yuv420p,scale=800x600 -an -vframes 10 -f md5 - Before: [auto_scaler_0 @ 0x7f96c3808680] w:iw h:ih flags:'' interl:0 [auto_scaler_0 @ 0x7f96c3808680] w:1920 h:1080 fmt:yuvj420p sar:0/1 -> w:1920 h:1080 fmt:yuv420p sar:0/1 flags:0x0 [Parsed_scale_1 @ 0x7f96c3806e40] w:1920 h:1080 fmt:yuv420p sar:0/1 -> w:800 h:600 fmt:yuv420p sar:0/1 flags:0x0 MD5=ff1d6091690c6fcd36d458d2a9f648ce After: [auto_scaler_0 @ 0x7fe94563b4c0] w:iw h:ih flags:'lanczos+bitexact+accurate_rnd' interl:0 [auto_scaler_0 @ 0x7fe94563b4c0] w:1920 h:1080 fmt:yuvj420p sar:0/1 -> w:1920 h:1080 fmt:yuv420p sar:0/1 flags:0xc0200 [Parsed_scale_1 @ 0x7fe945639d00] w:1920 h:1080 fmt:yuv420p sar:0/1 -> w:800 h:600 fmt:yuv420p sar:0/1 flags:0xc0200 MD5=ff1d6091690c6fcd36d458d2a9f648ce Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
* libavresample: Remove deprecated libraryAndreas Rheinhardt2021-04-27
| | | | | | | | Deprecated in c29038f3041a4080342b2e333c1967d136749c0f. The resample filter based upon this library has been removed as well. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: James Almer <jamrial@gmail.com>
* fftools/ffmpeg_filter: Fix check for mjpeg encoderAndreas Rheinhardt2021-04-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The MJPEG encoder supports some pixel format/color range combinations only when strictness is set to unofficial or less. Before commit 059fc2d9da5364627613fb3e6424079e14dbdfd3 said encoder's pix_fmts array only included the pixel formats supported with default strictness. When strictness was <= unofficial, fftools/ffmpeg_filter.c used an extended list of pixel formats instead of the encoder's including the pixel formats only supported when strictness <= unofficial. Said commit turned the logic around: The encoder's pix_fmts array now included all pixel formats and fftools/ffmpeg_filter.c instead used a small list of all pixel formats supported when strictness is > unofficial and the encoder's pixel formats instead. In particular, the codec's pix_fmt is not used when strictness is normal. This works for the mjpeg encoder; yet it did not work for other (hardware-based) mjpeg encoders, because the check for whether one is using the MJPEG encoder is wrong: It just checks the codec id. So if one used strict unofficial with a hardware-accelerated MJPEG encoder before commit 059fc2d9da53, the unofficial (non-hardware) pixel formats of the MJPEG encoder would be used; since said commit the codec's pixel formats are overridden at ordinary strictness by the ordinary MJPEG pixel formats. This leads to format conversion errors lateron which were reported in #9186. The solution to this is to check AVCodec.name instead of its id. Fixes ticket #9186. Tested-by: Eoff, Ullysses A <ullysses.a.eoff@intel.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/ffmpeg_filter: Don't needlessly copy stringAndreas Rheinhardt2021-04-10
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/ffmpeg_filter: Don't write string that is never usedAndreas Rheinhardt2021-04-10
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/ffmpeg_filter: Avoid allocations when configuring output filtersAndreas Rheinhardt2021-04-10
| | | | | | Use an AVBPrint to handle the (typically short) strings involved here. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mjpegenc: Include all supported pix_fmts in mpegenc pix_fmtsAndreas Rheinhardt2021-04-10
| | | | | | | | | | | | | | | Currently said list contains only the pixel formats that are always supported irrespective of the range and the value of strict_std_compliance. This makes the MJPEG encoder an outlier as all other codecs put all potentially supported pixel formats into said list and error out if the chosen pixel format is unsupported. This commit brings it therefore in line with the other encoders. The behaviour of fftools/ffmpeg_filter.c has been preserved. A more informed decision would be possible if colour range were available at this point, but it isn't. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/ffmpeg_filter: Don't use deprecated functionAndreas Rheinhardt2021-02-26
| | | | | | | | avcodec_find_best_pix_fmt_of_2 has been moved to libavutil in 617e866e25b72fa5d9f9d6bbcbd7e4bd69e63a54. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* fftools/ffmpeg_filter: Make functions only used locally staticAndreas Rheinhardt2021-02-02
| | | | | | Also remove some declarations of inexistent functions while at it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* fftools/ffmpeg_filter: Remove ist_in_filtergraphAndreas Rheinhardt2021-02-02
| | | | | | Unused since af1761f7b5b1b72197dc40934953b775c2d951cc. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* fftools/ffmpeg_filter: Remove choose_sample_fmtAndreas Rheinhardt2021-02-02
| | | | | | Unused since 6b35a83214f1bc3fb38c9ea9c2cd3676f28709fa. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* ffmpeg: remove dead code for -volGyan Doshi2021-01-31
| | | | It is applied via configure_input_audio_filter()
* fftools, libavcodec, libavfilter: Add const to some AVCodec *Andreas Rheinhardt2020-09-11
| | | | | | | | The user has no business modifying the underlying AVCodec. Reviewed-by: Paul B Mahol <onemda@gmail.com> Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* ffmpeg: add auto_conversion_filters option.Nicolas George2020-09-08
|
* fftools/ffmpeg_filter: add -autoscale to disable/enable the default scaleLinjie Fu2020-06-18
| | | | | | | | | | | | | | | | | | | | | Currently, ffmpeg inserts scale filter by default in the filter graph to force the whole decoded stream to scale into the same size with the first frame. It's not quite make sense in resolution changing cases if user wants the rawvideo without any scale. Using autoscale/noautoscale as an output option to indicate whether auto inserting the scale filter in the filter graph: -noautoscale or -autoscale 0: disable the default auto scale filter inserting. ffmpeg -y -i input.mp4 out1.yuv -noautoscale out2.yuv -autoscale 0 out3.yuv Update docs. Suggested-by: Mark Thompson <sw@jkqxz.net> Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com> Signed-off-by: Linjie Fu <linjie.fu@intel.com>
* fftools/ffmpeg_filter: check the codec's descriptor to see if it's losslessJames Almer2020-05-21
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* ffmpeg: Make filter hardware device selection clearerMark Thompson2020-04-26
| | | | Also move it into a dedicated function in the hardware file.
* ffmpeg: explicitly handle sub2video subpicture initializationJan Ekström2020-03-16
| | | | | | | | Each time the sub2video structure is initialized, the sub2video subpicture is initialized together with the first received heartbeat. The heartbeat's PTS is utilized as the subpicture start time. Additionally, add some documentation on the stages.
* fftools/ffmpeg_filter: remove sws_param option from buffersrcZhao Zhili2019-12-31
| | | | The option is deprecated and ignored by buffersrc.
* ffmpeg_filter: initialize sub2video.end_pts together with last_ptsJan Ekström2019-02-21
| | | | | | | | | | | This way re-initializations properly update end_pts, enabling sub2video_heartbeat to call sub2video_update as expected to re-init the sub2video AVFrame's contents and to feed a frame into the filter chain. This then fixes memory usage ballooning due to framesync waiting for secondary input in case of no actual subtitle samples being present for a while in source after a re-init occurs.