Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
ffmpeg generate video from images timestamped
11 février 2020, par user3262532I have a set of timestamped image as input and I want to generate a output video from it.
My command is :
ffmpeg -f image2 -ts_from_file 1 -i './%*.jpeg' './video.avi'
As output I get many errors:
.... [mjpeg @ 0x5591f1d5f100] bits 121 is invalid Error while decoding stream #0:0: Invalid data found when processing input [mjpeg @ 0x5591f1d5f100] mjpeg: unsupported coding type (c5) frame= 983 fps=130 q=31.0 size= 3078kB time=00:00:49.15 bitrate= 512.9kbits/[mjpeg @ 0x5591f1d5f100] EOI missing, emulating Last message repeated 4 times frame= 1048 fps=130 q=31.0 size= 3334kB time=00:00:52.40 bitrate= 521.2kbits/[mjpeg @ 0x5591f1d5f100] mjpeg: unsupported coding type (c8) frame= 1118 fps=130 q=31.0 size= 3590kB time=00:00:55.90 bitrate= 526.0kbits/[mjpeg @ 0x5591f1d5f100] bits 178 is invalid Error while decoding stream #0:0: Invalid data found when processing input [mjpeg @ 0x5591f1d5f100] mjpeg: unsupported coding type (c7) [mjpeg @ 0x5591f1d5f100] EOI missing, emulating Last message repeated 5 times frame= 1165 fps=130 q=24.8 Lsize= 3904kB time=00:00:58.25 bitrate= 549.0kbits/s speed=6.52x video:3870kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.864412%
The output video is not properly generates, the video file has the good framerate but visually the video is run too quick.
I try many commands to get proper output but I can get it.
-
Connect multiple video with different quality using ffmpeg
11 février 2020, par park johI have a series of 100 short videos, each one of them is encoding using h.265 but with a different quality level (CRF). I want to concatenation all of the 100 mp4 files to a single file but without re-encoding, so each part will save its own encoding parameters (they all at the same resolution, just different quality).
I want to use this option: https://ffmpeg.org/ffmpeg-formats.html#concat-1 of FFmpeg and wonder if it's going to work smoothly.
-
Saving a continuous stream of images from ffmpeg image2pipe using golang
11 février 2020, par MinaI am trying to save a sequence/continuous images from ffmpeg image2pipe in go. The problem with the code below that it does only save the first image in the stream due to the blocking nature of io.Copy since it waits for the reader or the writer to close.
package main import ( "fmt" "io" "log" "os" "os/exec" "strconv" "time" ) //Trying to get png from stdout pipe func main() { fmt.Println("Running the camera stream") ffmpegCmd := exec.Command("ffmpeg", "-loglevel", "quiet", "-y", "-rtsp_transport", "tcp", "-i", "rtsp://admin:123456@192.168.1.41:554/h264Preview_01_main", "-r", "1", "-f", "image2pipe", "pipe:1") ffmpegOut, err := ffmpegCmd.StdoutPipe() if err != nil { return } err = ffmpegCmd.Start() if err != nil { log.Fatal(err) } count := 0 for { count++ t := time.Now() fmt.Println("writing image" + strconv.Itoa(count)) filepath := "image-" + strconv.Itoa(count) + "-" + t.Format("20060102150405.png") out, err := os.Create(filepath) if err != nil { log.Fatal(err) } defer out.Close() _, err = io.Copy(out, ffmpegOut) if err != nil { log.Fatalf("unable to copy to file: %s", err.Error()) } } if err := ffmpegCmd.Wait(); err != nil { log.Fatal("Error while waiting:", err) } }
I implemented my own save and copy function based on the io.Copy code https://golang.org/src/io/io.go
func copyAndSave(w io.Writer, r io.Reader) error { buf := make([]byte, 1024, 1024) for { n, err := r.Read(buf[:]) if n == 0 { } if n > 0 { d := buf[:n] _, err := w.Write(d) if err != nil { return err } } if err != nil { return err } } return nil }
then I updated the for loop in my main function to the below block but still I am only getting the first image in the sequence. due to
r.Read(buf[:])
is being a blocking call.for { count++ t := time.Now() fmt.Println("writing image" + strconv.Itoa(count)) filepath := "image-" + strconv.Itoa(count) + "-" + t.Format("20060102150405.png") out, err := os.Create(filepath) if err != nil { log.Fatal(err) } defer out.Close() err = copyAndSave(out, ffmpegOut) if err != nil { if err == io.EOF { break } log.Fatalf("unable to copy to file: %s", err.Error()) break } }
Any help is appreciated and sorry for in typos in advance :)
-
display progress bar for ffmpeg process in front-end
11 février 2020, par ArunI'm working on a cms project in which i have to transcode video files using ffmpeg. The transcoding proecss has been successfull. But i have to display the progress of the ffmpeg process in front-end. I tried pytranscoder,which failed to display the progress. Any help will be appreciated.
Note: I'm using Ubuntu 14.04
-
FFMPEG GIF with transparency from png image sequence
11 février 2020, par Nick SI've been trying to use ffmpeg to create a gif with a transparent background, but whenever the movement goes on top of the background, the pixels stay there. It's a tree with a wind animation, this is how it ends up: https://i.imgur.com/pq4ArBG.png
I first try to create the palette, and then the gif:
ffmpeg -i Tree_%04d.png -vf palettegen=reserve_transparent=1 palette.png ffmpeg -framerate 30 -i Tree_%04d.png -i palette.png -lavfi paletteuse=alpha_threshold=128 treegif.gif
It seems the previous frames simply stay there, but I can't figure out how to dispose of them.