This program registered in the Windows service is executed as a server, which transcodes (encodes) an video using the resources of a web client and transmits the video to a ftp server.
- Added the function to display the remaining time.
IE / Edge |
Chrome |
---|---|
IE10, IE11 | last version |
go get github.com/Hunet-edutech/ffmpeg-web-client
-
To run the program, you need to download below libraries.
- golang/sys : windows service
- gorilla/websocket : websocket
- jinzhu/copier : deep copy
- dutchcoders/goftp : ftp client
- ffmpeg.exe / ffprobe.exe : ffmpeg and ffprobe .exe file
- goftp/server : ftp server for test
-
Change location of ffmpeg.exe / ffprobe.exe to directory of main.go
-
Run your ftp server for testing
exampleftpd -root /tmp
-
Check your ftp server's connection
ftp > open localhost 2121
-
Check your websocket connection after openning 'sample.html'
-
ftp server
Domain Port / 2121 -
default : localhost:5050
-
To connect websocket
-
Request
Get /echo
-
Progress Json Data
Field Description Optional fileIndex
file index no fileName
file name yes progressTime
current encoding time yes progressStatus
current encoding status (continue / end) no totalTime
file total time yes timeRemaining
encoding time emaining (일, 시/ 분, 분/초, 초) yes progressRate
encoding progress rate ( 00.00) no
-
-
To check a File existence of ftp server
-
Request
Get /fileExist
Query parameters :
Field Description Optional uploadFileName
file name to check(encoded file name) no courseCd
course code no -
Response
Content-Type : text/plain; exmaple : true(not exist) / false(exist) / error
-
-
To requst encoding and uploading a file
-
Request
Post /transcoding Content-Type : multipart/form-data;
-
Form Data :
Field Description Optional uploadFileData
file data no uploadFileInfo
information of 'uploadFileData' no uploadEncodingInfo
encoding information no -
'uploadFileInfo' Json Data :
Field Description Optional fileIndex
index no courseCd
course code no courseNo
course number(file name) no chapterNo
chapter number yes courseName
course name yes courseDetailName
course detail name yes uploadFileName
filename ('courseNo' + 'uploadFileExt') no uploadFileSize
file size yes uploadFileExt
filename extension yes -
'uploadEncodingInfo' Json Data :
Field Description Optional videoCodec
video codec no videoBitrate
video bitrate no audioCodec
audio codec no audioBitrate
audio bitrate no resolution
resolution no
-
-
Response
Content-Type : text/plain;
-
-
To stop trancoding
-
Request
DELETE /transcoding
-
Form Data :
Field Description Optional fileIndex
index no
-
-
Response
Content-Type : text/plain; exmaple : true / false
-
-
To check if service program is running
-
Request
Get /serviceCheck
-
Response
Content-Type : text/plain; exmaple : 1(running) / error
-
-
If you want to check logs, you must use Init() method in Run() method.
-
Due to the security issue(fakepath) on the web, the process will copy a stored data received from the web client, then encode it and send it to the ftp server. Therefore, this process must need to delete a stored data and encoded data on local.
-
You can stop to encoding a file, but you can't stop during uploading.
-
You can set the output directly to the ftp server during the ffmpeg encoding process, but it is not recommended.
-
the ftp server's file structure is
/GoTest/cource_code/cource_number.mp4