u2takey / ffmpeg-go

golang binding for ffmpeg
Apache License 2.0
1.77k stars 172 forks source link

How would you run a screen capture ffmpeg command #4

Closed RoughIndustries closed 3 years ago

RoughIndustries commented 3 years ago

This is for doing a screen capture on a mac but it is a universal screen capture problem.

So I have this command:

ffmpeg -f avfoundation -i "2" -c:v h264 -crf 15 -vf "scale=1920:1280,fps=60,format=yuv420p" output.mp4

How would it get the avfoundation into the input stream?

I am trying to use this:

` input := ffmpeg_go.Input("\"2\"", ffmpeg_go.KwArgs{"f": "avfoundation", "c:v": "h264", "crf": "15", "vf": "\"scale=1920:1280,fps=60,format=yuv420p\""})

output := input.Output("output.mp4")

output.Run() `

u2takey commented 3 years ago

This is for doing a screen capture on a mac but it is a universal screen capture problem.

So I have this command:

ffmpeg -f avfoundation -i "2" -c:v h264 -crf 15 -vf "scale=1920:1280,fps=60,format=yuv420p" output.mp4

How would it get the avfoundation into the input stream?

I am trying to use this:

` input := ffmpeg_go.Input(""2"", ffmpeg_go.KwArgs{"f": "avfoundation", "c:v": "h264", "crf": "15", "vf": ""scale=1920:1280,fps=60,format=yuv420p""})

output := input.Output("output.mp4")

output.Run() `

your example is right, but you maybe mixed output args with input args? this works for me:

out := Input("default:none", KwArgs{"f": "avfoundation", "framerate": "30"}).
        Output("output.mp4", KwArgs{"format": "mp4"}).
        OverWriteOutput()