Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
Insert text on sequence of image and create video using imagemagick or graphicsmagick with node.js
12 décembre 2015, par Keyur SakariaI am trying to create a sequence of image with dynamic text using imagemagick and then convert into video using ffmpeg. The issue I am facing right now:
- I was able to put text on image but now I want to move that text and sync with the character on image. Below is the link of what I have achieved
http://tinypic.com/player.php?v=2ciic8g%3E&s=9#.VmrAZUp97Dc
The bright white "text goes here" text should sync with the character behind
Below is the code which I have written
gm("original_images/moving/" + text + ".png") .fill("#FCF7FB") .fontSize(40) .drawText(x, moveY, "text goes here", "center") .font("font/BTTTRIAL_1.ttf") .write("newImages/demo" + i + ".png", function(err) { count++; console.log("success : " + err); console.log("i : " + i); console.log("moving : " + moveX); if(count == 72) { console.log(count); var date = moment().format('MMMMDDYYYYhmmssa'); var cmd = 'ffmpeg -r 17 -i newImages/demo%d.png -c:v libx264 -r 24 -pix_fmt yuv420p output/' + date + '.mp4'; exec(cmd, function(error, stdout, stderr) { console.log(error) console.log(stdout) console.log(stderr) }); } });
I am trying to calculate x and y according to image and im getting the values in decimal, which graphicsmagick is not considering and rounding it thus text is not syncing with image and goes up and down
If you have any other suggestions or ways to achieve what im trying to do please let me know.
Thanks in advance.
-
A bug in CV::VideoCapture::open() ?
12 décembre 2015, par wkingI am using
CV::VideoCapture
to capture frames from an IP camera. It works most of time, however, sometimes it reports the error:[mjpeg @ 0x233aea0] overread 8
And when this error occurred, my program just stuck there. This might explain why. But how can I solve it in C++ code? Can OpenCV handle this error without terminate the program?
p.s. I found that if I didn't call
CV::VideoCapture::read()
immediately, but wait for a while, like 60 seconds, afterCV::VideoCapture::open()
, this error occurred everytime! Is it a bug of OpenCV?#include #include
highgui/highgui.hpp> #include int main(int argc, char* argv[]) { // argv[1] is a valid url, like "http://xxxx/mjpg/video.mjpg" cv::VideoCapture cap(argv[1]); if (!cap.isOpened()) { std::cout << "Cannot Open Camera!" << std::endl; return -1; } // The error occures if I pause for a while. // But it is okay when I capture frames from video files intead of IP camera. sleep(60); while (static_cast (cv::waitKey(1)) != 'q') { cv::Mat frame; cap >> frame; if (frame.empty()) break; cv::imshow("frame", frame); } } -
Placing an image inside another image [on hold]
12 décembre 2015, par George R.I'm trying to place an image (small PNG file) inside a larger image (JPEG). Can I do this and choose where in the larger image the smaller gets positioned? Thanks
-
Merge 2 videos like PIP (pitcher in pitcher) using ffmpeg
12 décembre 2015, par Karthikeya VaidyaI am using ffmpeg to merge 2 videos as shown in below image. but the problem is both the videos are not in sync. To be more specific lets consider video1.mp4 starts at 00:01:00 and ends at 00:10:00 and video2.mp4 starts at 00:02:13 and ends at 00:10:00. Now I merge video1.mp4 and video2.mp4 to get pip.mp4 using below command
ffmpeg -i video1.mp4 -i video2.mp4 -filter_complex "[1]scale=iw/5:ih/5 [pip]; [0][pip] overlay=main_w-overlay_w-10:main_h-overlay_h-10" -profile:v main -level 3.1 -b:v 440k -ar 44100 -ab 128k -s 720x400 -vcodec h264 -acodec aac -strict experimental pip.mp4
The problem is time gap of 1 min 13 sec remains for entire output video. ffmpeg is maintaining the end time of both videos. How can I mix both the videos so that starting time difference is eliminated (from lengthy video) from video1.mp4 and after that mixing of videos begins at same time frame and output video will be in sync.
Can anyone please suggest me how to achieve this
Many Thanks
Karthik Vaidya
-
How to compile ffmpeg with x11grab ? xlib missing
12 décembre 2015, par ShumanI am compiling ffmpeg on centos 7.1 x64. The error message I got is
#### FFmpeg static build, by STVS SA #### *** Building FFmpeg *** ERROR: Xlib not found
config.log
gcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -I/home/shuman/github/ffmpeg-static/target/include -I/home/shuman/github/ffmpeg-static/target/include -static --static -std=c99 -fomit-frame-pointer -pthread -I/home/shuman/github/ffmpeg-static/target/include/opus -I/home/shuman/github/ffmpeg-static/target/include -I/home/shuman/github/ffmpeg-static/target/include -I/home/shuman/github/ffmpeg-static/target/include -I/home/shuman/github/ffmpeg-static/target/include -I/home/shuman/github/ffmpeg-static/target/include -I/home/shuman/github/ffmpeg-static/target/include -c -o /tmp/ffconf.eYdD6TBQ.o /tmp/ffconf.UnBT7bp1.c gcc -L/home/shuman/github/ffmpeg-static/target/lib -lm -L/home/shuman/github/ffmpeg-static/target/lib -lm -static -Wl,--as-needed -Wl,-z,noexecstack -o /tmp/ffconf.6gKhjd90 /tmp/ffconf.eYdD6TBQ.o -lxcb -lxvidcore -L/home/shuman/github/ffmpeg-static/target/lib -lx264 -lpthread -lm -L/home/shuman/github/ffmpeg-static/target/lib -lvpx -lm -L/home/shuman/github/ffmpeg-static/target/lib -lvpx -lm -L/home/shuman/github/ffmpeg-static/target/lib -lvpx -lm -L/home/shuman/github/ffmpeg-static/target/lib -lvpx -lm -lvorbisenc -lvorbis -logg -ltheoraenc -ltheoradec -logg -L/home/shuman/github/ffmpeg-static/target/lib -lrtmp -lz -lssl -lcrypto -L/home/shuman/github/ffmpeg-static/target/lib -lopus -lmp3lame -lfaac -lm -lbz2 -lz -pthread -ldl -lXext /usr/bin/ld: cannot find -lxcb collect2: error: ld returned 1 exit status ERROR: Xlib not found
but I have yum installed libxcb, what could be the reason for this?
edit:
$ rpm -qa | grep libxcb libxcb-devel-1.11-4.el7.x86_64 libxcb-1.11-4.el7.i686 libxcb-1.11-4.el7.x86_64 compat-libxcb-1.9-1.el7.x86_64 $ locate xcb.h /home/shuman/Downloads/buildroot/package/x11r7/libxcb/libxcb.hash /usr/include/X11/Xlib-xcb.h /usr/include/cairo/cairo-xcb.h /usr/include/xcb/xcb.h $ locate xcb.so /home/shuman/.dropbox-dist/dropbox-lnx.x86_64-3.10.11/libX11-xcb.so.1 /home/shuman/.dropbox-dist/dropbox-lnx.x86_64-3.10.11/plugins/platforms/libqxcb.so /usr/lib/libX11-xcb.so /usr/lib/libX11-xcb.so.1 /usr/lib/libX11-xcb.so.1.0.0 /usr/lib/libxcb.so.1 /usr/lib/libxcb.so.1.1.0 /usr/lib64/libX11-xcb.so /usr/lib64/libX11-xcb.so.1 /usr/lib64/libX11-xcb.so.1.0.0 /usr/lib64/libxcb.so /usr/lib64/libxcb.so.1 /usr/lib64/libxcb.so.1.1.0
edit: it turns out that it's because I'm not using the correct configure commandline, after following this guide, it works now
CFLAGS="-I$TARGET_DIR/include" LDFLAGS="-L$TARGET_DIR/lib" ./configure --prefix=${OUTPUT_DIR:-$TARGET_DIR} --extra-cflags="-I$TARGET_DIR/include" --extra-ldflags="-L$TARGET_DIR/lib" --pkg-config-flags="--static" --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-librtmp
in which, $TARGET_DIR is where all the dependency libs installed, this is part of my static ffmpeg build script ( with librtmp and libx265 and x11grab)