分類
好用軟體

使用ffmpeg擷圖live streaming

Live streaming擷圖, 可以利用 ffmpeg 工具來達成, 指令如下:

ffmpeg -y -i {live streaming url} -frames:v 1 {output file}

其中 -y 為 overwrite, -i 為 input, -frames:v 1 指擷出一張圖, 而最後的 output 為輸出, 範例指令如:

ffmpeg -y -i https://cph-p2p-msl.akamaized.net/hls/live/2000341/test/master.m3u8 -frames:v 1 test.jpg

(上面的 live streaming url 使用這裡的測試連結: https://ottverse.com/free-hls-m3u8-test-urls/ 第6項)

取得的內容為:

如此便能快速取得擷圖.

繼續閱讀:

https://ffmpeg.org/ffmpeg.html

[Javascript]Arrow function

在 Javascript 中, 使用 Arrow function 是個十分精簡的方式來呈現函數, 一般使用在匿名函數.

這篇寫得十分詳細:

https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Functions/Arrow_functions

由於 Arrow function是精簡型函數表示法, 所以有許多限制, 在一般使用時需要留意, 但在匿名函數使用時, 常常可以達成許多更精簡更便利的呈現方式.

這個語法是在 ES6 (EMACScript 6, EMACScript 2015)起開始, 也請參閱這裡:

https://ithelp.ithome.com.tw/articles/10195669