Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
How can I separate audio channels using libav C API ?
20 mai 2019, par zhenghong liI have some stereo audio files, and I wanna separate the left channel from the right channel and output the two channels into two different files/streams/containers using libav C API, how can I do that? The libav API documentation is good, but it takes time to read and try all these functions. Could anyone please give me a specific example.
-
Dynamic/Moving crop on cameraview on Android ? [on hold]
20 mai 2019, par SuisseI use MLkit to get the position and bounding box size of the persons head in the cameraview, what is the next step to crop the video frame by frame?
-
Problems piping ffmpeg to flac encoder
19 mai 2019, par Sebastian OlsenI need to encode a flac file with seektables, ffmpeg's flac encoder does not include seektables, so I need to use the flac CLI. I'm trying to make it possible to convert any arbitrary audio file to a seekable flac file by first piping it through ffmpeg, then to the flac encoder.
export const transcodeToFlac: AudioTranscoder<{}> = ({ source, destination }) => { return new Promise((resolve, reject) => { let totalSize = 0 const { stdout: ffmpegOutput, stderr: ffmpegError } = spawn("ffmpeg", [ "-i", source, "-f", "wav", "pipe:1" ]) const { stdout: flacOutput, stdin: flacInput, stderr: flacError } = spawn( "flac", ["-"] ) flacOutput.on("data", (buffer: Buffer) => { totalSize += buffer.byteLength }) ffmpegError.on("data", error => { console.log(error.toString()) }) flacError.on("data", error => { console.log(error.toString()) }) //stream.on("error", reject) destination.on("finish", () => { resolve({ mime: "audio/flac", size: totalSize, codec: "flac", bitdepth: 16, ext: "flac" }) }) ffmpegOutput.pipe(flacInput) flacOutput.pipe(destination) }) }
While this code works, the resulting flac file is not correct. The source audio is of duration
06:14
, but the flac file is of duration06:45:47
. Encoding the flac manually without piping ffmpeg to it works fine, but I cannot do that in a server environment where I need to utilize streams.Here's what the flac encoder outputs when transcoding:
flac 1.3.2 Copyright (C) 2000-2009 Josh Coalson, 2011-2016 Xiph.Org Foundation flac comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions. Type `flac' for details. -: WARNING: skipping unknown chunk 'LIST' (use --keep-foreign-metadata to keep) -: WARNING, cannot write back seekpoints when encoding to stdout -: 0% complete, ratio=0.357 0% complete, ratio=0.432 0% complete, ratio=0.482 0% complete, ratio=0.527 0% complete, ratio=0.541 1% complete, ratio=0.554 1% complete, ratio=0.563 1% complete, ratio=0.571 size= 36297kB time=00:03:30.70 bitrate=1411.2kbits/s speed= 421x 1% complete, ratio=0.572 1% complete, ratio=0.570 1% complete, ratio=0.577 1% complete, ratio=0.583 1% complete, ratio=0.584 1% complete, ratio=0.590 1% complete, ratio=0.592 size= 64512kB time=00:06:14.49 bitrate=1411.2kbits/s speed= 421x video:0kB audio:64512kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000185% -: WARNING: unexpected EOF; expected 1073741823 samples, got 16510976 samples 2% complete, ratio=0.579
-
Is there a way for ffmpeg to overlay png subtitles ?
19 mai 2019, par ib11I am working on a project to embed 24-bit png subtitles (they have custom letter and line-spacing as well as diffused dropshadow).
I am trying to find a way to overlay them with ffmpeg.
So far the only way I found was creating a DVDSUB file and overlay that, I simply used the following command from my earlier post:
@echo off set srcVidFile1="myvideo.mov" set srcSubFile=mysub.sub set srcIdxFile=mysub.idx set destFile=D:\testsub.mp4 ffmpeg.exe -i %srcVidFile1% -i %srcSubFile% -i %srcIdxFile% -filter_complex "[0:v][1:s]overlay" -c:s dvdsub -c:v libx264 -crf 24 -c:a aac -b:a 160K -ar 48K -strict -2 -y %destFile%
However I did not find yet a way to create a DVDSUB with the 24-bit png files I have.
I also looked at using SSA format as it does have a picture input, but I was not able to overlay the PNGs with ffmpeg. It seems to me that ffmpeg supports only "Dialogue" events in the SSA file, no "Picture" events.
Is there a way to overlay subtitles that are in PNG format?
-
Trancsode and generate waveform data file in ffmpeg with a single command
19 mai 2019, par user1152226I am trying to transcode and generate a waveform data file in the same command. I cannot figure out how to generate 2 output files from a single input. I want an mp4 file, and the waveform data file. The waveform data needs to be generated from the output of the transcoding step (ie, after the stream has already been transcoded)
The following does not work:
ffmpeg -i "https://mp3l.jamendo.com/?trackid=862797&format=mp31" -map 0:a -c:a libfdk_aac out1.mp4 -f data data.txt Output file #1 does not contain any stream