I am basically creating video from opengl animation uisng glreadpixels and unix pipeline :
FILE *ffmpeg = popen("/usr/local/Cellar/ffmpeg/2.5.4/bin/ffmpeg"
" -framerate 30"
" -vcodec rawvideo"
" -f rawvideo"
" -pix_fmt rgb32"
" -s 1080x720"
" -i pipe:0 -vf vflip -vcodec h264"
" -r 60"
" /Users/xamarin/Desktop/out.mp4", "w");
Is it possible to add watermark in each frame as i am creating frames for video. I know how to add watermark in existing video but i want to add watermark as i am creating video so that in on step i get video that has watermark in it. Suggest me some parameters for ffmpeg that can do this.
Use the overlay filter:
ffmpeg \
-framerate 30 -f rawvideo -pixel_format rgb32 -video_size 1080x720 -i pipe:0 \
-i overlay.png \
-i audio.foo \
-filter_complex "[0:v]vflip[main];[main][1:v]overlay=format=rgb,format=yuv420p" \
-c:v libx264 -c:a aac -movflags +faststart output.mp4
The rawvideo demuxer documentation lists -pixel_format instead of -pix_fmt and -video_size instead of -s.
You probably don't need -c:v rawvideo when you include -f rawvideo.
I removed -r 60 because it seems unnecessary to duplicate the frames.
You may see a visual improvement when adding format=rgb to the overlay filter for RGB inputs. The format filter is then used to make H.264 output with YUV 4:2:0 chroma subsampling which is needed for non-FFmpeg based players.
-movflags +faststart is helpful if your viewers will watch via progressive download.
Related
Sending a pcap file on port 0. I get the following error. Any fix would be appreciated!
The command used is:
sudo ./app/x86_64-native-linuxapp-gcc/pktgen -c 0X01 -n 1 --file-prefix=pg -w 4:00.1 -- -m 1.0 -T -P -s 0:~/Downloads/bigFlows.pcap
There are 2 obvious reasons for the failure.
Number of CPU cores for pktgen to work is 1 + number of ports in use
you have extra argument in comamnd executed in pktgen.
Checking the link, it show the command used is sudo ./app/x86_64-native-linuxapp-gcc/pktgen -c 0X01 -n 1 --file-prefix=pg -w 4:00.1 -- -m 1.0 -T -P -s 0:[~/Downloads/bigFlows.pcap]. You should not sue [] instead use 0:actual path to pcap.
Note: #SaifUllah during the live debug both core and pcap were show cased for you.
After unzip opencv3.1.0, I was cmake with:
sudo cmake -D CMAKE_BUILD_TYPE=RELEASE -D INSTALL_C_EXAMPLES=ON –D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_CUDA=ON -D CUDA_FAST_MATH=1 -D WITH_CUBLAS=1 -D WITH_OPENGL=ON -D WITH_V4L=ON –D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_TBB=ON ..
But when I run opencv-3.1.0/sample/gpu/video_reader.cpp with compile :
sudo g++ $(pkg-config --libs --cflags opencv) -o stream video_reader.cpp
I have received notice:
OpenCV was built without CUDA Video decoding support
I'm using Raspberry 3. Thanks all !
Raspberry Pi 3 has no NVIDIA GPU, therefore CUDA is not supported.
From NVIDIA page:
CUDA® is a parallel computing platform and programming model invented by NVIDIA. It enables dramatic increases in computing performance by harnessing the power of the graphics processing unit (GPU). - See more at: http://www.nvidia.com/object/cuda_home_new.html#sthash.5wWaGnZI.dpuf
From answer related to similar question:
Q: Is it possible to use the GPU for calculations? (e.g. CUDA/OpenCL)
A: Not at present - there is only a framebuffer interface for display purposes. There is no OpenCL and no plans for it nor is there documentation available to create OpenCL. CUDA is Nvida only so isn't applicable. Once an OpenGL driver becomes available you may be able to engineer some calculations via the GPU but how useful that will be remains to be seen.
Instead you can use OpenGL ES or OpenVG to write code using GPU. Raspberry PI video api
Now I have a IP camera. I tried to get a image through ffmpeg (like this : ffmpeg -rtsp_transport tcp -i "my rtsp stream address" -y -f image2 test.jpg ).That's OK! Or I tried to do this through opencv,no problem too.But when I open the stream in vlc,At the same time,I tried to capture the image ,oh,I just got a gray image.
why? if I open the stream in vlc two times,that's also OK! If capturing the image and view the rtsp stream together,just got a gray image.Is the reason of IP camera?normal imagegray image
Try this https://gist.github.com/jamek/1dda2add62b3f7ac415a
g++ -s -o ffmpeg_rtsp rtsp.cpp -lavcodec -lavutil -lswscale -lavformat
Run: ./ffmpeg_rtsp "your rtsp stream address"
How to use tar and filter the archive through LZ4? Or any available tools? It looks cumbersome to use tar cvf folderABC.tar folderABC && lz4c -c0 folderABC.tar.
PS: *nix environment
lz4 has a command line structure similar to gzip. Therefore, something like this will work :
tar cvf - folderABC | lz4 > folderABC.tar.lz4
or
tar cvf - folderABC | lz4 - folderABC.tar.lz4
First one compresses silently, like gzip. Second one is a bit more lz4-specific, and will also display summarized compression stats.
Decompression would go like this :
lz4 -d folderABC.tar.lz4 -c | tar xvf -
On GNU tar, you can use -I lz4
Both FreeBSD and GNU tar seems to support --use-compress-program=lz4 as well.
tar -I lz4 -cf archive.tar.lz4 stuff to add to archive
tar -I lz4 -xf archive.tar.lz4
or
tar --use-compress-program=lz4 -cf archive.tar.lz4 stuff to add to archive
tar --use-compress-program=lz4 -xf archive.tar.lz4
To use -I in GNU tar, you must specify it AFTER destination file as this:
tar cvf /path/to/destinationfile.tar.lz4 -I lz4 /path/to/archive
Core files are generated when a program terminates abnormally. It consists the working memory of the system when the program exits abnormally. You can use a debugger with the generated core file to debug the program. The Challenge is:
Delete all core files from a directory (recursive search). Core files are quite huge in size and you may want to delete them to save memory
Make sure you don't delete any folder named core and some other filed named core which not actually a memory/system dump
After some searching on the internet, I found a nice piece of code to do this. Drawback is it asks you to recognize the core file to make sure its not some other file named core. Source : http://csnbbs.com/
Code:
find . -name core\* -user $USER -type f -size +1000000c -exec file {} \; -exec ls -l {} \; -exec printf "\n\ny to remove this core file\n" \; -exec /bin/rm -i {} \;
Please post if you have better solutions.
To delete all files matching to the regex "*.core" you can use:
find . -name "*.core" -type f -delete
find supports many filters like:
-size +1000000c # size > 1G
-user $USER # specific user
-mtime +3 # older than 3 days
if you are afraid for files ending with "core" that are not core files you can filter by file command piped to some other linux commands. for example -
find . -name "*.core" -type f -exec file {} \; | grep 'core file' | awk -F":" '{print $1}' | xargs -n1 -P4 rm -rf