mirror of
https://github.com/owncast/owncast.git
synced 2024-10-10 19:16:02 +00:00
Fix short segment thumbnails. Move to JPG thumbs. Fix default thumb copy.
This commit is contained in:
parent
cfc7ea7967
commit
69da77b054
2
.gitignore
vendored
2
.gitignore
vendored
@ -18,7 +18,7 @@ vendor/
|
|||||||
config/config.yaml
|
config/config.yaml
|
||||||
config/stats.json
|
config/stats.json
|
||||||
owncast
|
owncast
|
||||||
webroot/thumbnail.png
|
webroot/thumbnail.jpg
|
||||||
webroot/hls
|
webroot/hls
|
||||||
webroot/static/content.md
|
webroot/static/content.md
|
||||||
hls/
|
hls/
|
@ -51,7 +51,7 @@ func showStreamOfflineState(configuration Config) {
|
|||||||
// "-stream_loop 100",
|
// "-stream_loop 100",
|
||||||
// "-fflags", "+genpts",
|
// "-fflags", "+genpts",
|
||||||
"-i", configuration.VideoSettings.OfflineImage,
|
"-i", configuration.VideoSettings.OfflineImage,
|
||||||
"-i", "webroot/thumbnail.png",
|
"-i", "webroot/thumbnail.jpg",
|
||||||
"-filter_complex", "\"[0:v]scale=2640:2360[bg];[bg][1:v]overlay=200:250:enable='between(t,0,3)'\"",
|
"-filter_complex", "\"[0:v]scale=2640:2360[bg];[bg][1:v]overlay=200:250:enable='between(t,0,3)'\"",
|
||||||
videoMapsString, // All the different video variants
|
videoMapsString, // All the different video variants
|
||||||
"-f hls",
|
"-f hls",
|
||||||
|
@ -21,7 +21,7 @@ GIT_COMMIT=$(git rev-list -1 HEAD)
|
|||||||
cd $(git rev-parse --show-toplevel)
|
cd $(git rev-parse --show-toplevel)
|
||||||
|
|
||||||
echo "Cleaning working directories..."
|
echo "Cleaning working directories..."
|
||||||
rm -rf ./webroot/hls/* ./hls/* ./webroot/thumbnail.png
|
rm -rf ./webroot/hls/* ./hls/* ./webroot/thumbnail.jpg
|
||||||
|
|
||||||
echo "Creating version ${VERSION} from commit ${GIT_COMMIT}"
|
echo "Creating version ${VERSION} from commit ${GIT_COMMIT}"
|
||||||
|
|
||||||
|
BIN
static/logo.png
Normal file
BIN
static/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 55 KiB |
@ -6,6 +6,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path"
|
"path"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -30,7 +31,9 @@ func startThumbnailGenerator(chunkPath string) {
|
|||||||
func fireThumbnailGenerator(chunkPath string) {
|
func fireThumbnailGenerator(chunkPath string) {
|
||||||
framePath := path.Join(chunkPath, "0")
|
framePath := path.Join(chunkPath, "0")
|
||||||
files, err := ioutil.ReadDir(framePath)
|
files, err := ioutil.ReadDir(framePath)
|
||||||
outputFile := path.Join("webroot", "thumbnail.png")
|
|
||||||
|
// JPG takes less time to encode than PNG
|
||||||
|
outputFile := path.Join("webroot", "thumbnail.jpg")
|
||||||
|
|
||||||
// fmt.Println("Generating thumbnail from", framePath, "to", outputFile)
|
// fmt.Println("Generating thumbnail from", framePath, "to", outputFile)
|
||||||
|
|
||||||
@ -63,7 +66,18 @@ func fireThumbnailGenerator(chunkPath string) {
|
|||||||
|
|
||||||
mostRecentFile := path.Join(framePath, names[0])
|
mostRecentFile := path.Join(framePath, names[0])
|
||||||
|
|
||||||
ffmpegCmd := "ffmpeg -y -i " + mostRecentFile + " -ss 00:00:01.000 -vframes 1 " + outputFile
|
thumbnailCmdFlags := []string{
|
||||||
|
configuration.FFMpegPath,
|
||||||
|
"-y", // Overwrite file
|
||||||
|
"-threads 1", // Low priority processing
|
||||||
|
"-t 1", // Pull from frame 1
|
||||||
|
"-i", mostRecentFile, // Input
|
||||||
|
"-f image2", // format
|
||||||
|
"-vframes 1", // Single frame
|
||||||
|
outputFile,
|
||||||
|
}
|
||||||
|
|
||||||
|
ffmpegCmd := strings.Join(thumbnailCmdFlags, " ")
|
||||||
|
|
||||||
// fmt.Println(ffmpegCmd)
|
// fmt.Println(ffmpegCmd)
|
||||||
|
|
||||||
|
6
utils.go
6
utils.go
@ -78,10 +78,10 @@ func resetDirectories(configuration Config) {
|
|||||||
|
|
||||||
func createInitialOfflineState() {
|
func createInitialOfflineState() {
|
||||||
// Provide default files
|
// Provide default files
|
||||||
showStreamOfflineState(configuration)
|
if !fileExists("webroot/thumbnail.jpg") {
|
||||||
if !fileExists("webroot/thumbnail.png") {
|
copy("static/logo.png", "webroot/thumbnail.jpg")
|
||||||
copy("static/logo.png", "webroot/thumbnail.png")
|
|
||||||
}
|
}
|
||||||
|
showStreamOfflineState(configuration)
|
||||||
}
|
}
|
||||||
|
|
||||||
func getClientIDFromRequest(req *http.Request) string {
|
func getClientIDFromRequest(req *http.Request) string {
|
||||||
|
@ -74,7 +74,7 @@ GW TODO:
|
|||||||
autoplay
|
autoplay
|
||||||
playsinline
|
playsinline
|
||||||
muted
|
muted
|
||||||
poster="/thumbnail.png"
|
poster="/thumbnail.jpg"
|
||||||
>
|
>
|
||||||
</video>
|
</video>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user