發表文章

目前顯示的是 5月, 2021的文章

How to install pyaudio on UBUNTU 20.04

圖片
How to install pyaudio on UBUNTU 20.04 pip install pyaudio error: first, install command: sudo apt-get install libasound-dev sudo apt-get install libasound-dev portaudio19-dev libportaudio2 libportaudiocpp0 then execute: pip install pyaudio should be success install.

How to using ffmpeg to split your exist video

圖片
 How to using ffmpeg to split your existing video into small videos by time. in Linux: if you already installed the FFmpeg, then FFmpeg can do this job, but the quality of video or audio maybe needs further setup: $ ffmpeg -i source-file -ss 0 -t 600 first-10-min.mkv $ ffmpeg -i source-file -ss 600 -t 600 second-10-min.mkv $ ffmpeg -i source-file -ss 1200 -t 600 third-10-min.mkv video quality if using H.264, you can reference this usage:  https://trac.ffmpeg.org/wiki/Encode/H.264 ffmpeg have presets and tune can using for encode video quality. Constant Rate Factor (CRF) The range of the CRF scale is 0–51, where 0 is lossless (for 8 bit only, for 10 bit use -qp 0), 23 is the default, and 51 is worst quality possible. CRF Example This command encodes a video with good quality, using slower preset to achieve better compression: ffmpeg -i input -c:v libx264 -preset slow -crf 22 -c:a copy output.mkv or for finding useage you can easily to using "ffmpeg -h" command to find it.  

HOW TO install nVIDIA CUDA toolkit , cudnn and nvcc and tensorflow2.5.0+keras, and Pytorch on UBUNTU

圖片
  HOW TO install nVIDIA CUDA toolkit and nvcc and tensorflow2.5.0+keras, and Pytorch on UBUNTU I installed it on UBUNTU 20.04. I using version 11.1  and the file is .deb to install: because on the Pytorch website, they have the 11.1 version now, so I installed the 11.1 version. but after few days, I found I can't using FFmpeg with GPU, then I purge all nvidia* and installed 11.3 version. before install:  before install, if your nVIDIA driver is higher than 455.23, you need to purge  Nvidia drivers: sudo apt-get purge nvidia* Install CUDA: Cuda download page:  https://developer.nvidia.com/cuda-11.1.0-download-archive?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=2004&target_type=deblocal using above page's command Base Installer Installation Instructions: wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600 wget https:

【Python】Python - Python for迴圈。Python for Loops.

圖片
 【Python】Python - Python for迴圈。Python for Loops. Python For 迴圈 for  迴圈通常使用在迭代如list, tuple, dictionary, set或string中。 這種寫法比較像物件導向程式語言的迭代方法,而比較不像其他程式語言的for keyword。 有了for 迴圈,我們可以對每個list, tuple, set...等裡面的每個item執行程式碼。 範例 列印水果list中的每個水果:  fruits = [ "apple" ,  "banana" ,  "cherry" ] for   x  in  fruits:    print (x) 上面輸出:  apple banana cherry The  for  迴圈不要求一定需要指標變數。 對一個String使用迴圈 因為String中包含多個characters,所以為一個iterable的物件。 範例 對文字"banana"使用迴圈去列印裡面的每個字元: for  x  in   "banana" :    print (x) 上面輸出: b a n a n a break 描述式 使用 break  描述式我們可以停止執行迴圈,這樣就不用將所有的items走過一遍。 範例 在x為"banana"時,離開迴圈: fruits = [ "apple" ,  "banana" ,  "cherry" ] for  x  in  fruits:    print (x)    if  x ==  "banana" :      break 上面輸出: apple banana 範例 在x為"banana"時,離開迴圈,但先執行break再列印: fruits = [ "apple" ,  "banana" ,  "cherry" ] for  x  in  fruits:    if  x ==  "banana" :      break  

HOW TO install Chrome browser on UBUNTU?

圖片
 HOW TO  install Chrome browser on UBUNTU? go to Chrome download page:  https://www.google.com/chrome/   then click download. open terminal. cd To_Your_Download_Folder. execute command: chmod +x google-chrome-stable_current_amd64.deb, the file will turn red to green in Terminal. execute command: sudo dpkg -i google-chrome-stable_current_amd64.deb that's it. you can find chrome already installed on the menu as APP. then enjoy browsing.

如何清除windows10裡面的最近使用文件並整理你的檔案

圖片
  如何清除windows10裡面的最近使用文件並整理你的檔案 最近使用的文件很有用,因為某些時候我們會忘了上個編輯的文件位置,最近使用的文件可以讓我們很容易的想起來,但有時候變得太雜亂,如我們可能截圖截了很多圖,但這些圖使用過後不再使用時,會讓檔案總管看起來很雜亂。 如果需要清除最近使用的文件可根據下面步驟: 開啟檔案總管,一般來說檔案總管應該會釘選在工作列上面。如果沒有釘選在工作列上面,你可以開啟任何資料夾,檔案總管就會開啟。 從檔案總管的最左上角按下「檔案」-> 「選項」,之後會彈出對話框。在彈出對話框的隱私權內有個「清除」按鈕。 按下「清除」按鈕,你的最近使用的文件會馬上被清除(沒有再次確認是否清除的對話框)。 圖片如下所示:

【Python】Python - Python While迴圈。Python While Loops.

圖片
 【Python】Python - Python While迴圈。Python While Loops. Python Loops Python 有2種主要的迴圈指令: while  迴圈 for  迴圈 while 迴圈   while  迴圈在狀態為true時,我們可以執行很多的statements。 範例 列印 i 的值當i小於 6時: i =  1 while  i <  6 :    print (i)   i +=  1 上面輸出: 1 2 3 4 5 Note:  記住對 i要不斷的增加, 否則迴圈會一直執行直到永遠。 因為 while  迴圈要求一個指標變數,所以我們先宣告一個變數 i 並設定為1。 break 描述式 使用 break  我們可以停止迴圈。 範例 當 i 為 3 時離開迴圈: i =  1 while  i <  6 :    print (i)    if  i ==  3 :      break   i +=  1 上面輸出: 1 2 3 continue 描述式 使用  continue  我們可以不執行迴圈內在continue之後的程式碼,繼續從迴圈開始執行。 範例  if i 為 3時,繼續執行下一個迭代: i =  0 while  i <  6 :   i +=  1    if  i ==  3 :      continue    print (i) 上面輸出: 1 2 4 5 6 else 描述式 使用  else  描述式,我們可以執行當狀態不為true時的程式碼區塊。 範例 列印訊息一次,當狀態為false時: i =  1 while  i <  6 :    print (i)   i +=  1 else :    print ( "i is no longer less than 6" ) 上面輸出: 1 2 3 4 5 i is no longer less than 6