Cleaned up demo.go
This commit is contained in:
parent
3b9be17551
commit
c41eca1bbe
2 changed files with 3 additions and 10 deletions
2
demo.go
2
demo.go
|
@ -10,8 +10,6 @@ func main() {
|
||||||
output := "output.mp4"
|
output := "output.mp4"
|
||||||
video := NewVideo(filename)
|
video := NewVideo(filename)
|
||||||
|
|
||||||
fmt.Println(video.bitrate)
|
|
||||||
|
|
||||||
writer := NewVideoWriter(output, video)
|
writer := NewVideoWriter(output, video)
|
||||||
defer writer.Close()
|
defer writer.Close()
|
||||||
|
|
||||||
|
|
|
@ -32,12 +32,6 @@ func NewVideoWriter(filename string, video *Video) *VideoWriter {
|
||||||
if video.fps == 0 {
|
if video.fps == 0 {
|
||||||
video.fps = 25 // Default to 25 FPS.
|
video.fps = 25 // Default to 25 FPS.
|
||||||
}
|
}
|
||||||
if video.codec == "" {
|
|
||||||
video.codec = "mpeg4" // Default to MPEG4.
|
|
||||||
}
|
|
||||||
if video.pix_fmt == "" {
|
|
||||||
video.pix_fmt = "rgb24" // Default to RGB24.
|
|
||||||
}
|
|
||||||
return &VideoWriter{
|
return &VideoWriter{
|
||||||
filename: filename,
|
filename: filename,
|
||||||
width: video.width,
|
width: video.width,
|
||||||
|
@ -45,8 +39,8 @@ func NewVideoWriter(filename string, video *Video) *VideoWriter {
|
||||||
channels: video.channels,
|
channels: video.channels,
|
||||||
bitrate: video.bitrate,
|
bitrate: video.bitrate,
|
||||||
fps: video.fps,
|
fps: video.fps,
|
||||||
codec: video.codec,
|
codec: "mpeg4",
|
||||||
pix_fmt: video.pix_fmt,
|
pix_fmt: "rgb24",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,6 +55,7 @@ func (writer *VideoWriter) initVideoWriter() {
|
||||||
"-vcodec", "rawvideo",
|
"-vcodec", "rawvideo",
|
||||||
"-s", fmt.Sprintf("%dx%d", writer.width, writer.height), // frame w x h
|
"-s", fmt.Sprintf("%dx%d", writer.width, writer.height), // frame w x h
|
||||||
"-pix_fmt", writer.pix_fmt,
|
"-pix_fmt", writer.pix_fmt,
|
||||||
|
//"-b:v", fmt.Sprintf("%d", writer.bitrate), // bitrate
|
||||||
"-r", fmt.Sprintf("%f", writer.fps), // frames per second
|
"-r", fmt.Sprintf("%f", writer.fps), // frames per second
|
||||||
"-i", "-", // The imput comes from stdin
|
"-i", "-", // The imput comes from stdin
|
||||||
"-an", // Tells FFMPEG not to expect any audio
|
"-an", // Tells FFMPEG not to expect any audio
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue