Skip to content

Instantly share code, notes, and snippets.

@softworkz
Created May 24, 2020 02:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save softworkz/4f4bf2c1365d2ce3f6ac70b1b434aa40 to your computer and use it in GitHub Desktop.
Save softworkz/4f4bf2c1365d2ce3f6ac70b1b434aa40 to your computer and use it in GitHub Desktop.
ffmpeg Filtergraph Output Example
{
"FilterGraphs": [{
"Description": "[0:3]scale@f1=width=1920:height=1080:force_original_aspect_ratio=decrease[f1_out0];[0:0][f1_out0]overlay@f2=x=(W-w)/2:y=(H-h):repeatlast=0[f2_out0]",
"Filters": [{
"Filter": {
"Description": "Scale the input video size and/or convert the image format.",
"Inputs": [{
"LinkType": "Input",
"ChannelLayout": 0,
"Channels": 0,
"DestPadName": "default",
"Format": "bgra",
"Height": 1080,
"MediaTypeId": 0,
"SampleRate": 0,
"SAR": "0:1",
"SourceName": "trim_in_0_3",
"SourcePadName": "default",
"Width": 1920
}
],
"Name": "scale@f1",
"Name2": "scale",
"Outputs": [{
"LinkType": "Output",
"ChannelLayout": 0,
"Channels": 0,
"DestName": "overlay@f2",
"DestPadName": "overlay",
"Format": "yuva420p",
"Height": 1080,
"MediaTypeId": 0,
"SampleRate": 0,
"SAR": "0:1",
"SourceName": "scale@f1",
"Width": 1920
}
]
}
}, {
"Filter": {
"Description": "Overlay a video source on top of the input.",
"Inputs": [{
"LinkType": "Input",
"ChannelLayout": 0,
"Channels": 0,
"DestPadName": "main",
"Format": "nv12",
"Height": 1080,
"MediaTypeId": 0,
"SampleRate": 0,
"SAR": "1:1",
"SourceName": "trim_in_0_0",
"SourcePadName": "default",
"Width": 1920
}, {
"LinkType": "Input",
"ChannelLayout": 0,
"Channels": 0,
"DestPadName": "overlay",
"Format": "yuva420p",
"Height": 1080,
"MediaTypeId": 0,
"SampleRate": 0,
"SAR": "0:1",
"SourceName": "scale@f1",
"SourcePadName": "default",
"Width": 1920
}
],
"Name": "overlay@f2",
"Name2": "overlay",
"Outputs": [{
"LinkType": "Output",
"ChannelLayout": 0,
"Channels": 0,
"DestName": "format",
"DestPadName": "default",
"Format": "nv12",
"Height": 1080,
"MediaTypeId": 0,
"SampleRate": 0,
"SAR": "1:1",
"SourceName": "overlay@f2",
"Width": 1920
}
]
}
}, {
"Filter": {
"Description": "Buffer video frames, and make them accessible to the filterchain.",
"Inputs": [
],
"Name": "graph 0 input from stream 0:3",
"Name2": "buffer",
"Outputs": [{
"LinkType": "Output",
"ChannelLayout": 0,
"Channels": 0,
"DestName": "trim_in_0_3",
"DestPadName": "default",
"Format": "bgra",
"Height": 1080,
"MediaTypeId": 0,
"SampleRate": 0,
"SAR": "0:1",
"SourceName": "graph 0 input from stream 0:3",
"Width": 1920
}
]
}
}, {
"Filter": {
"Description": "Pick one continuous section from the input, drop the rest.",
"Inputs": [{
"LinkType": "Input",
"ChannelLayout": 0,
"Channels": 0,
"DestPadName": "default",
"Format": "bgra",
"Height": 1080,
"MediaTypeId": 0,
"SampleRate": 0,
"SAR": "0:1",
"SourceName": "graph 0 input from stream 0:3",
"SourcePadName": "default",
"Width": 1920
}
],
"Name": "trim_in_0_3",
"Name2": "trim",
"Outputs": [{
"LinkType": "Output",
"ChannelLayout": 0,
"Channels": 0,
"DestName": "scale@f1",
"DestPadName": "default",
"Format": "bgra",
"Height": 1080,
"MediaTypeId": 0,
"SampleRate": 0,
"SAR": "0:1",
"SourceName": "trim_in_0_3",
"Width": 1920
}
]
}
}, {
"Filter": {
"Description": "Buffer video frames, and make them accessible to the filterchain.",
"Inputs": [
],
"Name": "graph 0 input from stream 0:0",
"Name2": "buffer",
"Outputs": [{
"LinkType": "Output",
"ChannelLayout": 0,
"Channels": 0,
"DestName": "trim_in_0_0",
"DestPadName": "default",
"Format": "nv12",
"Height": 1080,
"MediaTypeId": 0,
"SampleRate": 0,
"SAR": "1:1",
"SourceName": "graph 0 input from stream 0:0",
"Width": 1920
}
]
}
}, {
"Filter": {
"Description": "Pick one continuous section from the input, drop the rest.",
"Inputs": [{
"LinkType": "Input",
"ChannelLayout": 0,
"Channels": 0,
"DestPadName": "default",
"Format": "nv12",
"Height": 1080,
"MediaTypeId": 0,
"SampleRate": 0,
"SAR": "1:1",
"SourceName": "graph 0 input from stream 0:0",
"SourcePadName": "default",
"Width": 1920
}
],
"Name": "trim_in_0_0",
"Name2": "trim",
"Outputs": [{
"LinkType": "Output",
"ChannelLayout": 0,
"Channels": 0,
"DestName": "overlay@f2",
"DestPadName": "main",
"Format": "nv12",
"Height": 1080,
"MediaTypeId": 0,
"SampleRate": 0,
"SAR": "1:1",
"SourceName": "trim_in_0_0",
"Width": 1920
}
]
}
}, {
"Filter": {
"Description": "Buffer video frames, and make them available to the end of the filter graph.",
"Inputs": [{
"LinkType": "Input",
"ChannelLayout": 0,
"Channels": 0,
"DestPadName": "default",
"Format": "nv12",
"Height": 1080,
"MediaTypeId": 0,
"SampleRate": 0,
"SAR": "1:1",
"SourceName": "format",
"SourcePadName": "default",
"Width": 1920
}
],
"Name": "out_0_0",
"Name2": "buffersink",
"Outputs": [
]
}
}, {
"Filter": {
"Description": "Convert the input video to one of the specified pixel formats.",
"Inputs": [{
"LinkType": "Input",
"ChannelLayout": 0,
"Channels": 0,
"DestPadName": "default",
"Format": "nv12",
"Height": 1080,
"MediaTypeId": 0,
"SampleRate": 0,
"SAR": "1:1",
"SourceName": "overlay@f2",
"SourcePadName": "default",
"Width": 1920
}
],
"Name": "format",
"Name2": "format",
"Outputs": [{
"LinkType": "Output",
"ChannelLayout": 0,
"Channels": 0,
"DestName": "out_0_0",
"DestPadName": "default",
"Format": "nv12",
"Height": 1080,
"MediaTypeId": 0,
"SampleRate": 0,
"SAR": "1:1",
"SourceName": "format",
"Width": 1920
}
]
}
}
],
"GraphIndex": 0,
"Inputs": [{
"LinkType": "Input",
"ChannelLayout": 0,
"Channels": 0,
"Description": "Buffer video frames, and make them accessible to the filterchain.",
"Format": "bgra",
"Height": 1080,
"MediaType": "video",
"MediaTypeId": 0,
"Name1": "scale",
"Name2": "graph 0 input from stream 0:3",
"Name3": "buffer",
"SampleRate": 0,
"SAR": "0:0",
"Width": 1920
}, {
"LinkType": "Input",
"ChannelLayout": 0,
"Channels": 0,
"Description": "Buffer video frames, and make them accessible to the filterchain.",
"Format": "nv12",
"Height": 1080,
"MediaType": "video",
"MediaTypeId": 0,
"Name1": "overlay:main",
"Name2": "graph 0 input from stream 0:0",
"Name3": "buffer",
"SampleRate": 0,
"SAR": "1:1",
"Width": 1920
}
],
"Outputs": [{
"LinkType": "Output",
"ChannelLayout": 0,
"Channels": 0,
"Description": "Buffer video frames, and make them available to the end of the filter graph.",
"Format": "nv12",
"Height": 1080,
"MediaType": "video",
"MediaTypeId": 0,
"Name1": "overlay",
"Name2": "out_0_0",
"Name3": "buffersink",
"SampleRate": 0,
"Width": 1920
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment