ffplay 中filter的使用

weixin_34391854發表於2014-05-16

新增字幕:
ffplay -vf drawtext="fontfile=arial.ttf: text='Test Text': x=100: y=300: \
 fontsize=48: fontcolor=red: box=1: boxcolor=white" /d/ts/music.ts
把x=100 改成 x=50*t 可以使文字向右滾動。

 

./ffplay -vf drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text': x=100: y=50: fontsize=24: fontcolor=yellow@0.2: box=1: boxcolor=red@0.2" h.mp4

 

黑白漫畫風格顯示:
ffplay -vf edgedetect=low=0.1:high=0.4 /d/ts/music.ts

 

./ffplay -vf edgedetect=low=0.1:high=0.4 h.mp4

對比正常視訊和deshake 過的視訊:
-vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'

堆疊視訊/馬賽克:
ffplay /d/ts/music.ts -vf 'scale=128:72,tile=4x4'
ffplay /d/ts/mis.ts -vf select='gt(scene\,0.4)',scale=160:120,tile

快進:
ffplay /d/ts/mis.ts -vf setpts=0.5*PTS

Audio Source:
 生成440Hz正弦訊號,設定取樣率為8000Hz:
 ffplay -nostats -f lavfi aevalsrc="sin(440*2*PI*t)::s=8000" 

Video Source:
 元包自動機:
 ffplay -nostats -f lavfi cellauto
 類似地,還有分形圖案mandelbrot, 模擬life, 測試testsrc

todo:
how to use "nullsrc" <--the input content is to be ignored. for analysis/debugging?
synthesize a voice utterance using libflite

 

 

[0]=>Parsed_setpts_0

[1]=>ffplay_buffersink

[2]=>ffplay_crop

[3]=>ffplay_buffer

 

(gdb) p *filter->graph->filters[0]->inputs[0]->srcpad
$266 = {name = 0x8ee5a3d "default", type = AVMEDIA_TYPE_VIDEO, min_perms = 0, rej_perms = 0, start_frame = 0, get_video_buffer = 0,
  get_audio_buffer = 0, end_frame = 0, draw_slice = 0, filter_frame = 0, poll_frame = 0x8078c28 <poll_frame>,
  request_frame = 0x8078ba5 <request_frame>, config_props = 0x8078b01 <config_props>, needs_fifo = 0, needs_writable = 0}
(gdb) p *filter->graph->filters[1]->inputs[0]->srcpad
$267 = {name = 0x8eeef6c "default", type = AVMEDIA_TYPE_VIDEO, min_perms = 0, rej_perms = 0, start_frame = 0, get_video_buffer = 0,
  get_audio_buffer = 0, end_frame = 0, draw_slice = 0, filter_frame = 0, poll_frame = 0, request_frame = 0,
  config_props = 0x808fc6e <config_output>, needs_fifo = 0, needs_writable = 0}
(gdb) p *filter->graph->filters[2]->inputs[0]->srcpad
$268 = {name = 0x8ee8ccc "default", type = AVMEDIA_TYPE_VIDEO, min_perms = 0, rej_perms = 0, start_frame = 0, get_video_buffer = 0,
  get_audio_buffer = 0, end_frame = 0, draw_slice = 0, filter_frame = 0, poll_frame = 0, request_frame = 0, config_props = 0,
  needs_fifo = 0, needs_writable = 0}

 

 

(gdb) p *filter->graph->filters[0]->inputs[0]->dstpad
$270 = {name = 0x8ee8ccc "default", type = AVMEDIA_TYPE_VIDEO, min_perms = 0, rej_perms = 0, start_frame = 0, get_video_buffer = 0,
  get_audio_buffer = 0, end_frame = 0, draw_slice = 0, filter_frame = 0x8083a6b <filter_frame>, poll_frame = 0, request_frame = 0,
  config_props = 0x80838c9 <config_input>, needs_fifo = 0, needs_writable = 0}
(gdb) p *filter->graph->filters[1]->inputs[0]->dstpad
$271 = {name = 0x8ee4fec "default", type = AVMEDIA_TYPE_VIDEO, min_perms = 0, rej_perms = 0, start_frame = 0, get_video_buffer = 0,
  get_audio_buffer = 0, end_frame = 0, draw_slice = 0, filter_frame = 0x80768fe <filter_frame>, poll_frame = 0, request_frame = 0,
  config_props = 0, needs_fifo = 0, needs_writable = 0}
(gdb) p *filter->graph->filters[2]->inputs[0]->dstpad
$272 = {name = 0x8eeef6c "default", type = AVMEDIA_TYPE_VIDEO, min_perms = 0, rej_perms = 0, start_frame = 0, get_video_buffer = 0,
  get_audio_buffer = 0, end_frame = 0, draw_slice = 0, filter_frame = 0x808fcb0 <filter_frame>, poll_frame = 0, request_frame = 0,
  config_props = 0x808f4c2 <config_input>, needs_fifo = 0, needs_writable = 0}

 

(gdb) p *filter->graph->filters[3]->inputs
Cannot access memory at address 0x0

 

 

 

(gdb) p *filter->graph->filters[0]->outputs[0]->srcpad
$275 = {name = 0x8ee8ccc "default", type = AVMEDIA_TYPE_VIDEO, min_perms = 0, rej_perms = 0, start_frame = 0, get_video_buffer = 0,
  get_audio_buffer = 0, end_frame = 0, draw_slice = 0, filter_frame = 0, poll_frame = 0, request_frame = 0, config_props = 0,
  needs_fifo = 0, needs_writable = 0}

(gdb) p *filter->graph->filters[1]->outputs[0]->srcpad
Cannot access memory at address 0x0
(gdb) p *filter->graph->filters[2]->outputs[0]->srcpad
$276 = {name = 0x8eeef6c "default", type = AVMEDIA_TYPE_VIDEO, min_perms = 0, rej_perms = 0, start_frame = 0, get_video_buffer = 0,
  get_audio_buffer = 0, end_frame = 0, draw_slice = 0, filter_frame = 0, poll_frame = 0, request_frame = 0,
  config_props = 0x808fc6e <config_output>, needs_fifo = 0, needs_writable = 0}
(gdb) p *filter->graph->filters[3]->outputs[0]->srcpad
$277 = {name = 0x8ee5a3d "default", type = AVMEDIA_TYPE_VIDEO, min_perms = 0, rej_perms = 0, start_frame = 0, get_video_buffer = 0,
  get_audio_buffer = 0, end_frame = 0, draw_slice = 0, filter_frame = 0, poll_frame = 0x8078c28 <poll_frame>,
  request_frame = 0x8078ba5 <request_frame>, config_props = 0x8078b01 <config_props>, needs_fifo = 0, needs_writable = 0}

 

 

 

(gdb) p *filter->graph->filters[0]->outputs[0]->dstpad
$278 = {name = 0x8eeef6c "default", type = AVMEDIA_TYPE_VIDEO, min_perms = 0, rej_perms = 0, start_frame = 0, get_video_buffer = 0,
  get_audio_buffer = 0, end_frame = 0, draw_slice = 0, filter_frame = 0x808fcb0 <filter_frame>, poll_frame = 0, request_frame = 0,
  config_props = 0x808f4c2 <config_input>, needs_fifo = 0, needs_writable = 0}
(gdb) p *filter->graph->filters[1]->outputs[0]->dstpad
Cannot access memory at address 0x0
(gdb) p *filter->graph->filters[2]->outputs[0]->dstpad
$279 = {name = 0x8ee4fec "default", type = AVMEDIA_TYPE_VIDEO, min_perms = 0, rej_perms = 0, start_frame = 0, get_video_buffer = 0,
  get_audio_buffer = 0, end_frame = 0, draw_slice = 0, filter_frame = 0x80768fe <filter_frame>, poll_frame = 0, request_frame = 0,
  config_props = 0, needs_fifo = 0, needs_writable = 0}
(gdb) p *filter->graph->filters[3]->outputs[0]->dstpad
$280 = {name = 0x8ee8ccc "default", type = AVMEDIA_TYPE_VIDEO, min_perms = 0, rej_perms = 0, start_frame = 0, get_video_buffer = 0,
  get_audio_buffer = 0, end_frame = 0, draw_slice = 0, filter_frame = 0x8083a6b <filter_frame>, poll_frame = 0, request_frame = 0,
  config_props = 0x80838c9 <config_input>, needs_fifo = 0, needs_writable = 0}

 

 

#0  ff_filter_frame (link=0xad333a20, frame=0xad334020) at libavfilter/avfilter.c:1163
#1  0x08090098 in filter_frame (link=0xad333f60, frame=0xad334020) at libavfilter/vf_crop.c:297
#2  0x080729c1 in ff_filter_frame_framed (link=0xad333f60, frame=0xad334020) at libavfilter/avfilter.c:1081
#3  0x08072d35 in ff_filter_frame (link=0xad333f60, frame=0xad334020) at libavfilter/avfilter.c:1161
#4  0x08084382 in filter_frame (inlink=0xad333940, frame=0xad334020) at libavfilter/setpts.c:210
#5  0x080729c1 in ff_filter_frame_framed (link=0xad333940, frame=0xad334020) at libavfilter/avfilter.c:1081
#6  0x08072d35 in ff_filter_frame (link=0xad333940, frame=0xad334020) at libavfilter/avfilter.c:1161
#7  0x08078c26 in request_frame (link=0xad333940) at libavfilter/buffersrc.c:500
#8  0x08070bcf in ff_request_frame (link=0xad333940) at libavfilter/avfilter.c:346
#9  0x08070bf4 in ff_request_frame (link=0xad333f60) at libavfilter/avfilter.c:348
#10 0x08070bf4 in ff_request_frame (link=0xad333a20) at libavfilter/avfilter.c:348
#11 0x08076a3b in av_buffersink_get_frame_flags (ctx=0xad3332a0, frame=0xad500480, flags=0) at libavfilter/buffersink.c:138

相關文章