"-f", "mp3", // using mp3 muxer (IMPORTANT, output data to pipe require manual muxer selecting) ![]() "-b:a", "128k", // Down sample audio birate to 128k "-vsync", "2", // suppress "Frame rate very high for a muxer not efficiently supporting it" "-c:a", "libmp3lame", // use mp3 lame codec "-map_metadata", "-1", // strip out all (mostly) metadata "-hide_banner", "-loglevel", "panic", // Hide all logs ![]() Please change the command which suits you: package mainįile, err := os.Open("test.mp3") // open fileĬmd := exec.Command("ffmpeg", "-y", // Yes to all Please check this out, I wrote this to down sample mp3 files to 128k bitrate and it should work with you. Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used) Video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB Pipe:0: Invalid data found when processing inputįinishing stream 0:0 without any data written to it. Log.Print("Size of the image: ", len(imageBytes)) ( EDIT: I tried to pipe the byte array to ffmpeg now, but ffmpeg does not fill in my buffer: width := 640 How can I achieve the same with a raw video?Ī user from reddit told me that I might achieve this with but I was unable to find any resources. This is how someone would do it with a static and encoded file using ffmpeg: filename := "test.mp4"Ĭmd := exec.Command("ffmpeg", "-i", filename, "-vframes", "1", "-s", fmt.Sprintf("%dx%d", width, height), "-f", "singlejpeg", "-") W.Write(byte("Error uploading the file"))Īnd I need a single frame of the video and convert it to a png. I have a video directly from the http body in a byte format: //Parsing video
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |