Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
while build a demo about ffmpeg , it occurs : undefined reference to `av_register_all'
25 février, par CodyThis problem has bothered me for days.
After I compile and install FFmpeg, I try to build a demo using it, but it always fails.
The demo is:
#include "libavcodec/avcodec.h" #include "libavformat/avformat.h" int main(int argc,char *argv[]) { av_register_all(); return 1; }
With
gcc main.c -o main.o
, an error occurs:undefined reference to 'av_register_all'
Building with:
gcc main.c -o main.o -lm -ld -lz -lavcodec -lavformat -lavutil
, another error occurs:/usr/bin/ld: cannot find -ld
How can I resolve this?
-
Animated watermark moving on the edges of the movie - ffmpeg
25 février, par saeid ezzatiI wanna overlay a picture on a video, as a watermark. How do I insert an animated watermark that randomly moves from side to side.
For example, A watermark, placed on top/ upper-left corner, moves randomly to the top/upper-right corner and freezes there for five seconds before moving down to the lower- right corner.
I don't want the watermark to have a cross movement and move from the upper-right corner to the lower-left corner.
Here is an example of my code, using which the watermark randomly jumps to a corner each 200 frames without animate:
ffmpeg -i "source.mp4" -i "watermark.png" -filter_complex "[1:v]scale=50:-1[a]; [0:v][a]overlay=x='st(0,floor(random(n)*2)+1);if(eq(mod(n-1,200),0), if(eq(ld(0),1),0, main_w-overlay_w ) ,x)':y='st(0,floor(random(n)*2)+1);if(eq(mod(n-1,200),0),if(eq(ld(0),1),0, main_h-overlay_h ),y)'" -codec:a copy "out.mp4"
-
Libav linking error : undefined references
25 février, par FedechHere's my problem:
- I built ffmpeg from source (version 1.2), the libav* libraries are in /usr/local/lib and they're static
- I'm compiling a ns3 (www.nsnam.org) module, so my only control over the linker is through the env variable LINKFLAGS
- In the source the headers are in a "extern C" block, so it's not the usual g++ name mangling
- I set LINKFLAGS="-I/usr/local/include/libavformat -I/usr/local/include/libavcodec -I/usr/local/include/libavutil -L/usr/local/lib -lavformat -lavcodec -lavutil", and the linker can't seem to find any of the libav* functions I call (I get a lot of "undefined reference" and then "collect2: error: ld returned status 1"
Can anyone help me? Thanks...
edit: here are a few of the undefined reference messages:
./libns3.14.1-qoe-monitor-debug.so: undefined reference to `av_guess_format' ./libns3.14.1-qoe-monitor-debug.so: undefined reference to `av_read_frame' ./libns3.14.1-qoe-monitor-debug.so: undefined reference to `avformat_write_header' ./libns3.14.1-qoe-monitor-debug.so: undefined reference to `av_interleaved_write_frame' ./libns3.14.1-qoe-monitor-debug.so: undefined reference to `av_find_stream_info' ./libns3.14.1-qoe-monitor-debug.so: undefined reference to `av_register_all' ./libns3.14.1-qoe-monitor-debug.so: undefined reference to `av_init_packet' ./libns3.14.1-qoe-monitor-debug.so: undefined reference to `avformat_alloc_context' ./libns3.14.1-qoe-monitor-debug.so: undefined reference to `av_dump_format' ./libns3.14.1-qoe-monitor-debug.so: undefined reference to `avio_close'
edit2: here is the message I get after "build failed":
-> task in 'scratch-simulator' failed (exit status 1): {task 53952272: cxxprogram scratch-simulator.cc.1.o -> scratch-simulator} ['/usr/bin/g++', '-I/usr/local/include/libavcodec', '-I/usr/local/include/libavformat/', '-I/usr/local/include/libavutil/', '-L/usr/local/lib', '-I/usr/local /include/libavcodec', '-I/usr/local/include/libavformat/', '-I/usr/local/include /libavutil/', '-L/usr/local/lib', '-pthread', '-pthread', '-Wl,-z,relro', 'scratch/scratch-simulator.cc.1.o', '-o', '/home/fede/Thesis/ns-allinone-3.14.1 /ns-3.14.1/build/scratch/scratch-simulator', '-Wl,-Bstatic', '-Wl,-Bdynamic', '-Wl,--no-as-needed', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L/usr/lib', '-lns3.14.1-test-debug', '-lns3.14.1- csma-layout-debug', '-lns3.14.1-point-to-point-layout-debug', '-lns3.14.1-netanim- debug', '-lns3.14.1-lte-debug', '-lns3.14.1-spectrum-debug', '-lns3.14.1-antenna- debug', '-lns3.14.1-aodv-debug', '-lns3.14.1-dsdv-debug', '-lns3.14.1-dsr-debug', '-lns3.14.1-mesh-debug', '-lns3.14.1-olsr-debug', '-lns3.14.1-csma-debug', '-lns3.14.1- wimax-debug', '-lns3.14.1-applications-debug', '-lns3.14.1-virtual-net-device-debug', '-lns3.14.1-uan-debug', '-lns3.14.1-energy-debug', '-lns3.14.1-flow-monitor-debug', '-lns3.14.1-nix-vector-routing-debug', '-lns3.14.1-tap-bridge-debug', '-lns3.14.1- visualizer-debug', '-lns3.14.1-internet-debug', '-lns3.14.1-bridge-debug', '-lns3.14.1- point-to-point-debug', '-lns3.14.1-mpi-debug', '-lns3.14.1-wifi-debug', '-lns3.14.1- buildings-debug', '-lns3.14.1-propagation-debug', '-lns3.14.1-mobility-debug', '-lns3.14.1-config-store-debug', '-lns3.14.1-tools-debug', '-lns3.14.1-stats-debug', '-lns3.14.1-emu-debug', '-lns3.14.1-topology-read-debug', '-lns3.14.1-network-debug', '-lns3.14.1-qoe-monitor-debug', '-lns3.14.1-core-debug', '-lrt', '-lgsl', '-lgslcblas', '-lm', '-ldl', '-lgtk-x11-2.0', '-lgdk-x11-2.0', '-latk-1.0', '-lgio-2.0', '-lpangoft2-1.0', '-lpangocairo-1.0', '-lgdk_pixbuf-2.0', '-lcairo', '-lpango-1.0', '-lfreetype', '-lfontconfig', '-lgobject-2.0', '-lglib-2.0', '-lxml2', '-lpython2.7']
-
PHP convert any video to MP4 using ffmpeg
25 février, par DilakI have a website in which I allow users to upload videos. But with the HTML5 tag video, only MP4 videos are allowed
So, I want to convert any type of videos that the users upload to MP4 and then add the path in my database.
I tried something, changing the file extension to MP4 but it didn't work. I've read something about ffmepg but I can't figure out how to use it.
Here is my PHP script where I change the file extension and then add the path in my data base, please how can I convert the video correctly, what should I add/change?
<?php if(file_exists($_FILES['media-vid']['tmp_name']) && is_uploaded_file($_FILES['media-vid']['tmp_name'])) { $targetvid = md5(time()); $target_dirvid = "videos/"; $target_filevid = $targetvid.basename($_FILES["media-vid"]["name"]); $uploadOk = 0; $videotype = pathinfo($target_filevid,PATHINFO_EXTENSION); $video_formats = array( "mpeg", "mp4", "mov", "wav", "avi", "dat", "flv", "3gp" ); foreach ($video_formats as $valid_video_format) { if (preg_match("/$videotype/i", $valid_video_format)) { $target_filevid = $targetvid . basename($_FILES["media-vid"] . ".mp4"); $uploadOk = 1; break; } else { //if it is an image or another file format it is not accepted $format_error = "Invalid Video Format!"; } } if ($_FILES["media-vid"]["size"] > 5000000000000) { $uploadOk = 0; echo "Sorry, your file is too large."; } // Check if $uploadOk is set to 0 by an error if ($uploadOk == 0 && isset($format_error)) { echo "Sorry, your video was not uploaded."; // if everything is ok, try to upload file } else if ($uploadOk == 0) { echo "Sorry, your video was not uploaded."; } else { $target_filevid = strtr($target_filevid, 'ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÒÓÔÕÖÙÚÛÜÝàáâãäåçèéêëìíîïðòóôõöùúûüýÿ', 'AAAAAACEEEEIIIIOOOOOUUUUYaaaaaaceeeeiiiioooooouuuuyy'); $target_filevid = preg_replace('/([^.a-z0-9]+)/i', '_', $target_filevid); if (!move_uploaded_file($_FILES["media-vid"]["tmp_name"], $target_dirvid. $target_filevid)) { echo "Sorry, there was an error uploading your file. Please retry."; } else { $vid= $target_dirvid.$target_filevid; $nbvid = 1; } } } ?>
Thank you.
-
How do I record a Selenium Grid Session (Via VNC, Remote Frame Buffer - RFB) to an H264 encoded MP4 [closed]
25 février, par FrobbitWhen my integration tests fail, I want to be able to watch the video of the test running. I test a full stack app with docker-compose and I use the single container Selenium-grid. If I save every Secenerio to a file, I can quickly review a failed test.
I'm trying to record a Selenium Grid session and save it as an MP4 file using GStreamer and VNC. I need a solution that captures the VNC session running in the Selenium Grid container and writes the output to an H264 encoded mp4 file.
Here's the context:
I'm using Selenium Grid with a VNC server running in the container. I can access the VNC session using the se:vncLocalAddress capability.
I would like a tool that can record the VNC remote framebuffer (RFB) output.
Can someone provide a reliable way to record a Selenium Grid session to an MP4 file using a tool like GStreamer or ffmpeg?