TUS-OSK / bushitsuchan-PC

部室の様子を見れるシステム 部室ちゃん
0 stars 1 forks source link

Framerate on macOS #26

Closed ilim0t closed 5 years ago

ilim0t commented 5 years ago

ffmpegのコマンド (一例)

ffmpeg -f avfoundation -re -i 0 -r 10 -vcodec libx264 -pix_fmt yuv420p -preset veryfast -tune zerolatency,stillimage,film -vb 2500k -vf "drawtext=text='%{localtime}':fontcolor=white@0.8:x=0:y=h-lh*1.2:fontsize=24" -f flv rtmp://localhost:1935/live/bushitsuchan -loglevel warning

のようなコマンドを内部で実行しているが,そのときに

[avfoundation @ 0x7fa860008400] Selected framerate (29.970030) is not supported by the device
[avfoundation @ 0x7fa860008400] Supported modes:
[avfoundation @ 0x7fa860008400]   1280x720@[1.000000 30.000000]fps

上記のエラーが発生する

ilim0t commented 5 years ago

これはその端末がデフォルトframerateの29.970030に対応してないから発生するエラーであり, -framerate 30 という引数をつけ

ffmpeg -framerate 30 -f avfoundation -re -i 0 -r 10 -vcodec libx264 -pix_fmt yuv420p -preset veryfast -tune zerolatency,stillimage,film -vb 2500k -vf "drawtext=text='%{localtime}':fontcolor=white@0.8:x=0:y=h-lh*1.2:fontsize=24" -f flv rtmp://localhost:1935/live/bushitsuchan -loglevel warning

に変更すると解消する

ilim0t commented 5 years ago

ただこの変更をすべての端末に対して行うと,今度は30fpsに対応していない端末で同様のエラー

[avfoundation @ 0x7fa860008400] Selected framerate (29.970030) is not supported by the device
[avfoundation @ 0x7fa860008400] Supported modes:
以下省略

と出てしまう。

対応framerateを調べそれに応じ引数を変えられるようにしたい

ilim0t commented 5 years ago

コードの該当箇所

ilim0t commented 5 years ago

https://trac.ffmpeg.org/wiki/Capture/Webcam 参考になるかも

ilim0t commented 5 years ago

docker化に従いmacでのサポートをdebug用のみに限定し カメラの代わりにビデオファイルで代用できるようにしました よってcloseします