Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
Dump libx264 encoding parameters in ffmpeg
23 novembre 2012, par melihIs it possible to get a list of parameter values used in libx264 while encoding a stream? I am using a ffmpeg binary to encode.
-
Differences in multimedia frameworks
23 novembre 2012, par user1837038I've been recently investigating different multimedia frameworks for adding audio and video capabilities to my applications.
I've been looking at phonon, gstreamer, ffmpeg, libvlc/vlc.
However, I cannot find a good resource that answers some of my general questions.
- Are these interchangeable?
- Do they work in the same level?
- Do you have any experience using some and can give feedback of why did you chose one over the other?
Thanks
-
Video with background image
23 novembre 2012, par Gabriele Murarisince my video doesn't respect the safe area i thought to make it smaller and fill the background area (the resulting video must be 720x576 px) with a still image.
So i've created a movie out of a still image (loop_video.mpg) and then i tried to mix it with my input video using it as a watermark. Doing so i lose the audio stream that comes from my input video.
here my code:
ffmpeg -i loop_video.mpg -vf \"movie=input.mpg, scale=648:519 [wm];[in][wm] overlay=36:28 [out]\" -b:v 4096k -bufsize 8192k -minrate 2048k -maxrate 8192k -y -t 10 out.mpg
So i tried to mix the two and keeping just the audio stream of my input video, and then watermarking again, but i have a significant delay between video and audio stream. It seems that the watermark starts after 1 second:
ffmpeg -i loop_video.mpg -i input.mpg -map 0:0 -map 1:1 -vf \"movie=input.mpg, scale=648:519 [wm];[in][wm] overlay=36:28 [out]\" -b:v 4096k -bufsize 8192k -minrate 2048k -maxrate 8192k -y -t 10 out.mpg
Someone could help me?
Thanks so much
-
Header missing in mpg, in spite of using avformat_write_header
23 novembre 2012, par TheSHEEEPI am encoding a live rendered video to mpg and/or mp4 (depends on the later usage of the video) using the ffmpeg C API. When encoding to mp4, everything is well. But when encoding to mpg, the resulting video cannot be played by any player. A quick call to ffprobe on it reveals that the header is missing. But this seems pretty much impossible, as I am explicitly writing it.
This is how I write the header, before any frame is encoded:
// ptr->oc is the AVFormatContext int error = avformat_write_header(ptr->oc, NULL); if (error < 0) { s_logFile << "Could not write header. Error: " << error << endl; fprintf(stderr, "Could not write header. Error: '%i'\n", error); return 1; }
There never is any error when writing the header.
For encoding, I am following the official muxing.c example, so I do set the CODEC_FLAG_GLOBAL_HEADER flag. I use CODEC_ID_MPEG2VIDEO (for video) and CODEC_ID_MP2 (for audio).
The result mpg does work when I "encode" it in an additional step with an external ffmpeg executable like this: "ffmpeg -i ownEncoded.mpg -sameq -y working.mpg". So it seems all the data is there, only the header is missing for some reason...
Here is the only thing ffmpeg is reporting before/when writing the header:
mpeg ------------------- lvl: 24 msg: VBV buffer size not set, muxing may fail
Could that be the problem?
I wonder what could be wrong here as I encode mp4 with the exact same function, except setting some special values like qmin, qmax, me_method, etc. when encoding to mp4. Do I probably have to set any special values so that ffmpeg really does write the header correctly?
-
Running a 2-pass video conversion using Python's subprocess module and ffmpeg
22 novembre 2012, par ensnareI'm trying to convert a bunch of videos to play on my iPad. I'm using the subprocess module, which from what I understand launches a binary in a separate process from my script. I'm not sure how to handle 2-pass encoding which requires that the first process terminate before the second begin.
Here is my code:
def convert(filename): extension = filename[-3:] destination_filename_720 = filename[-4:] + '-a720p' + '.mp4' destination_filename_1080 = filename[-4:] + '-a1080p' + '.mp4' p = subprocess.Popen(['ffmpeg','-i', str(filename) , '-acodec' , 'aac' , '-ab' , '160k' , '-ac' , '2' , '-vcodec' , 'libx264' , '-strict' , '-2' , '-vpre' , 'ipod640' , '-threads' , '8' , '-s' , '1280x720' , '-b:v' , '2000k' , '-pass' , '1' , '-y' , destination_filename_720]) p = subprocess.Popen(['ffmpeg','-i', str(filename) , '-acodec' , 'aac' , '-ab' , '160k' , '-ac' , '2' , '-vcodec' , 'libx264' , '-strict' , '-2' , '-vpre' , 'ipod640' , '-threads' , '8' , '-s' , '1280x720' , '-b:v' , '2000k' , '-pass' , '2' , '-y' , destination_filename_720])
As soon as the convert() function is called, both processes are spawned immediately.
The second process fails because the first process hasn't yet finished.
How can I fix this? Or, is there a better way?