From: Good Guy Date: Sun, 14 Oct 2018 21:57:18 +0000 (-0600) Subject: add ffmpeg audio pts tolerance, update plugin info X-Git-Url: https://cinelerra-gg.org/git/?a=commitdiff_plain;h=2ce5f3585284c78107b6eab879ee4e94686ff41a;p=goodguy%2Fhistory.git add ffmpeg audio pts tolerance, update plugin info --- diff --git a/cinelerra-5.1/cinelerra/ffmpeg.C b/cinelerra-5.1/cinelerra/ffmpeg.C index a18ae88c..65e0c780 100644 --- a/cinelerra-5.1/cinelerra/ffmpeg.C +++ b/cinelerra-5.1/cinelerra/ffmpeg.C @@ -15,6 +15,8 @@ #define INT64_MAX 9223372036854775807LL #endif #define MAX_RETRY 1000 +// max pts/curr_pos drift allowed before correction (in seconds) +#define AUDIO_PTS_TOLERANCE 0.04 #include "asset.h" #include "bccmodels.h" @@ -758,6 +760,7 @@ int FFAudioStream::load_history(uint8_t **data, int len) int FFAudioStream::decode_frame(AVFrame *frame) { int first_frame = seeked; seeked = 0; + frame->best_effort_timestamp = AV_NOPTS_VALUE; int ret = avcodec_receive_frame(avctx, frame); if( ret < 0 ) { if( first_frame || ret == AVERROR(EAGAIN) ) return 0; @@ -766,8 +769,13 @@ int FFAudioStream::decode_frame(AVFrame *frame) return -1; } int64_t pkt_ts = frame->best_effort_timestamp; - if( pkt_ts != AV_NOPTS_VALUE ) - curr_pos = ffmpeg->to_secs(pkt_ts - nudge, st->time_base) * sample_rate + 0.5; + if( pkt_ts != AV_NOPTS_VALUE ) { + double ts = ffmpeg->to_secs(pkt_ts - nudge, st->time_base); + double t = (double)curr_pos / sample_rate; +// some time_base clocks are very grainy, too grainy for audio (clicks, pops) + if( fabs(ts - t) > AUDIO_PTS_TOLERANCE ) + curr_pos = ts * sample_rate + 0.5; + } return 1; } @@ -845,7 +853,8 @@ int FFAudioStream::audio_seek(int64_t pos) if( pos == curr_pos ) return 0; reset_history(); mbsz = 0; // guarentee preload > 1sec samples - if( seek(pos-sample_rate, sample_rate) < 0 ) return -1; + if( (pos-=sample_rate) < 0 ) pos = 0; + if( seek(pos, sample_rate) < 0 ) return -1; return 1; } diff --git a/cinelerra-5.1/info/plugins.txt b/cinelerra-5.1/info/plugins.txt index 6b411fe8..da578dd4 100644 --- a/cinelerra-5.1/info/plugins.txt +++ b/cinelerra-5.1/info/plugins.txt @@ -15,7 +15,7 @@ AgingTV: Use to achieve an "old" movie or TV show effect by adding moving lines and snow. Auto Scale: Automatically scale to a specified size. Blue Banana: Used for color transformation or remapping as - well as chroma-key filtering. Basic usage: + well as chroma-key filtering. Features5 37.8 usage: . Select a specifc target color. . Create a selection region by expanding color. . Optionally reduce or expand the alpha plane. @@ -229,6 +229,7 @@ F_bwdif: Deinterlaces the input image. F_chromakey: Turns a certain color into transparency. Operates on YUV colors. F_ciescope: Video CIE scope. +F_color: Provide an uniformly colored input. F_colorbalance: Adjusts the color balance. F_colorchannelmixer: Adjusts colors by mixing color channels. F_colorkey: Turns a certain color into @@ -238,7 +239,9 @@ F_colormatrix: Converts color matrix. F_cover_rect: Find and cover a user specified object. F_crop: Crops the input video. F_cropdetect: Auto-detect crop size +F_curves: Adjust components curves. F_datascope: Video data analysis. +F_dctdnoiz: Denoise frames using 2D DCT. F_deband: Debands video. F_deflate: Applies deflate effect. F_deflicker: Remove temporal frame luminance variations. @@ -278,6 +281,7 @@ F_field: Extract a field from the input video. F_fieldorder: Set the field order. F_fillborders: Fill borders of the input video. F_floodfill: Fill area of the same color with another color. +F_format: Convert the input video to one of the specified pixel formats. F_framerate: Upsamples or downsamples progressive source between specified frame rates. F_fspp: Applies Fast Simple Post-processing filter. @@ -304,9 +308,11 @@ F_lut: Compute and apply a lookup F_lut3d: Apply a 3D LUT (look up table) to an input video. F_lutrgb: Compute and apply a lookup table to the RGB input video. F_lutyuv: Combine and apply a lookup table to the YUV input video. +F_mandelbrot: Render a Mandelbrot fractal. F_mcdeint: Applies motion compensating deinterlacing. F_mestimate: Generate motion vectors. F_mpdecimate: Remove near-duplicate frames. +F_mptestsrc: Generate various test pattern. F_negate: Negates input video. F_nlmeans: Non-local means denoiser. An example usage is for the recovery of VHS tapes which look bad. @@ -328,6 +334,7 @@ F_pp: Filters video using libpostproc. F_pp7: Applies Postprocessing 7 filter. F_prewitt: Apply prewitt operator. F_pseudocolor: Make pseudocolored video frames. +F_rgbtestsrc: Generate RGB test pattern. F_readeia608: Read EIA-608 Closed Caption codes from input video and write them to frame metadata. F_readvitc: Reads vertical interval @@ -341,9 +348,11 @@ F_roberts: Apply roberts cross operator which performs a simple/quick 2-D most likely correspond to edges. F_rotate: Rotates the input image. F_sab: Applies shape adaptive blur. +F_scale: Scale the input video size and/or convert the image format. F_separatefields: Split input video frames into fields. F_setrange: Force color range for the output video frame. F_showinfo: Show textual information for each video frame. +F_showpalette: Display frame palette. F_shuffleframes: Shuffles video frames. F_shuffleplanes: Shuffles video planes. F_signalstats: Separates statistics from video analysis. @@ -358,9 +367,14 @@ F_super2xsai: Scales the input by 2x using the Super2xSal pixel art algorithm. F_swaprect: Swaps 2 rectangular objects in video. F_swapuv: Swaps U and V components. +F_tblend: Blend successive frames. +F_testsrc: Generate test pattern. +F_testsrc2: Generate another test pattern. +F_tile: Tile several successive frames together. F_tinterlace: Performs temporal field interlacing. F_tlut2: Compute and apply a lookup table from 2 successive frames. F_transpose: Transposes input video. +F_unsharp: Sharpen or blur the input video. F_uspp: Applies Ultra Simple/Slow Post-processing filter. F_vaguedenoiser: Applies a Wavelet based Denoiser. F_vectorscope: Video vectorscope. @@ -375,6 +389,7 @@ F_waveform: Video waveform monitor. F_weave: Weaves input video fields into frames. F_xbr: Scales the input using xBR algorithm. F_yadif: Deinterlaces the input image. +F_yuvtestsrc: Generate YUV test pattern. F_zoompan: Applies Zoom & Pan effect. # # Description of FFmpeg Audio Plugins @@ -388,7 +403,10 @@ F_aecho: Adds echoing to the audio. F_aemphasis: Audio emphasis. F_aeval: Filters audio signal according to a specific expression. F_afade: Fades in/out input audio. +F_aformat: Convert the input audio to one of the specified formats. F_agate: Audio gate. +F_aiir: Apply infinite Impulse Response filter with supplied + coefficients. F_allpass: Applies a two-pole all-pass filter. F_aloop: Loops audio samples. F_anoisesrc: Generates a noise audio signal. @@ -396,6 +414,7 @@ F_aperms: Set permissions for the output audio frame. F_aphaser: Adds a phasing effect to the audio. F_arealtime: Slows down filtering to match realtime. F_aresample: Resamples audio data. +F_asetrate: Change the sample rate without altering the data. F_astats: Shows time domain statistics about audio frames F_atempo: Adjusts audio tempo. F_atrim: Pick one continuous section from the input, drop the rest.