Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
Absolute timestamp as MP4 start time
14 juin 2016, par galbarmI'd like to store the exact start time a video was recorded on, inside its mp4 container. I need a millisecond accuracy (i.e. year,month,day,hour,sec,milli). Such an accuracy requires 8 bytes.
The only standard way I found to store a video creation time is to use the mvhd/tkhd/mdhd boxes creation_time field. But according to the base media file format spec, the field only gives a granularity of seconds:
creation_time is an integer that declares the creation time of this track (in seconds since midnight, Jan. 1, 1904, in UTC time)
In version 0 the field size was 4 bytes, while in version 1 it was increased to 8 bytes. But the description remained unchanged so it can still only reflect a timestamp in up to second granularity. (for maintaining backward compatibility maybe?)
So finally, is there a standard way to store a single absolute timestamp with millisecond accuracy in a mp4 container? If the only way to do it, is to store it as a custom metadata, is there an agreed common way to do it according to?
-
Vagrant provision fails to execute the next script without an obvious reason why
14 juin 2016, par JakeTheSnakeI've created/co-opted several bash scripts to provision my guest Ubuntu 14.04 OS; the one giving me trouble right now is installing ffmpeg. When the script finishes, vagrant simply does nothing save for sending SSH keep-alives.
Host OS: Windows 7 x64
The last output before the infinitely repeating keep-alives is:
INSTALL libavutil/sha.h INSTALL libavutil/sha512.h INSTALL libavutil/stereo3d.h INSTALL libavutil/threadmessage.h INSTALL libavutil/time.h INSTALL libavutil/timecode.h INSTALL libavutil/timestamp.h INSTALL libavutil/tree.h INSTALL libavutil/twofish.h INSTALL libavutil/version.h INSTALL libavutil/xtea.h INSTALL libavutil/tea.h INSTALL libavutil/lzo.h INSTALL libavutil/avconfig.h INSTALL libavutil/ffversion.h DEBUG ssh: stdout: INSTALL libavutil/libavutil.pc DEBUG ssh: stdout: Done DEBUG ssh: Sending SSH keep-alive... DEBUG ssh: Sending SSH keep-alive... DEBUG ssh: Sending SSH keep-alive...
Here are the relevant scripts:
Vagrantfile
# -*- mode: ruby -*- # vi: set ft=ruby : # All Vagrant configuration is done below. The "2" in Vagrant.configure # configures the configuration version (we support older styles for # backwards compatibility). Please don't change it unless you know what # you're doing. Vagrant.configure(2) do |config| # The most common configuration options are documented and commented below. # For a complete reference, please see the online documentation at # https://docs.vagrantup.com. # Every Vagrant development environment requires a box. You can search for # boxes at https://atlas.hashicorp.com/search. config.vm.box = 'ubuntu/trusty64' config.vm.hostname = 'dev' config.ssh.forward_agent = true config.ssh.pty = true # Create a private network, which allows host-only access to the machine # using a specific IP. config.vm.network :private_network, type: :dhcp, auto_config: false # Create a public network, which generally matched to bridged network. # Bridged networks make the machine appear as another physical device on # your network. config.vm.network :public_network, ip: '192.168.11.14', bridge: 'Realtek PCIe GBE Family Controller' # Share an additional folder to the guest VM. The first argument is # the path on the host to the actual folder. The second argument is # the path on the guest to mount the folder. And the optional third # argument is a set of non-required options. # # Do not share root directory of vagrant # config.vm.synced_folder '.', '/vagrant', disabled: true # Share ruby repository directories config.vm.synced_folder '.', '/home/vagrant/apps', nfs: true, mount_options: [ 'nfsvers=3', 'vers=3', 'actimeo=1', 'rsize=8192', 'wsize=8192', 'timeo=14', :nolock, :udp, :intr, :user, :auto, :exec, :rw ] # Provider-specific configuration so you can fine-tune various # backing providers for Vagrant. These expose provider-specific options. # Example for VirtualBox: # config.vm.provider :virtualbox do |vb| # Display the VirtualBox GUI when booting the machine vb.gui = true # Use VBoxManage to customize the VM. vb.name = 'Ubuntu' vb.cpus = 4 vb.memory = 2048 vb.customize ['modifyvm', :id, '--vram', 64] vb.customize ['modifyvm', :id, '--audio', :dsound] vb.customize ['modifyvm', :id, '--audiocontroller', :ac97] vb.customize ['modifyvm', :id, '--clipboard', :bidirectional] end # Provisioning config.vm.provision :shell, path: './provisioning/user/install-apps.sh', privileged: false, name: 'Applications' config.vm.provision :shell, path: './provisioning/user/install-rvm.sh', args: 'stable', privileged: false, name: 'RVM' config.vm.provision :shell, path: './provisioning/user/install-ruby.sh', args: '2.3.1', privileged: false, name: 'Ruby' config.vm.provision :shell, path: './provisioning/user/install-ruby-gems.sh', privileged: false, name: 'Ruby Gems' config.vm.provision :shell, path: './provisioning/root/install-nginx.sh', args: '1.9.9', name: 'Nginx' config.vm.provision :chef_solo do |chef| # chef.version = '12.10.40' # Paths to your cookbooks (on the host) chef.cookbooks_path = ['cookbooks'] # Add chef recipes chef.add_recipe 'apt' chef.add_recipe 'git' # Is required for NPM chef.add_recipe 'sqlite' chef.add_recipe 'mysql' chef.add_recipe 'nodejs' chef.add_recipe 'memcached' chef.add_recipe 'imagemagick' chef.add_recipe 'optipng' chef.add_recipe 'sublime-text' chef.add_recipe 'tomcat' end end
install-apps.sh
#!/usr/bin/env bash echo Turning off console beeps... grep '^set bell-style none' /etc/inputrc || echo 'set bell-style none' >> /etc/inputrc echo Installing languages sudo apt-get -y update sudo locale-gen en_US en_US.UTF-8 sudo dpkg-reconfigure locales echo Installing essential apps sudo apt-get -y install build-essential curl yasm echo Installing desktop apps sudo apt-get -y install ubuntu-desktop hash ffmpeg 2>/dev/null || { # Build ffmpeg echo Installing ffmpeg sudo apt-get -y install autoconf automake libass-dev libfreetype6-dev \ libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev \ libxcb-xfixes0-dev pkg-config texinfo zlib1g-dev libx264-dev libmp3lame-dev libopus-dev mkdir ~/ffmpeg_sources cd ~/ffmpeg_sources wget http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 tar xjvf ffmpeg-snapshot.tar.bz2 cd ffmpeg PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure \ --prefix="$HOME/ffmpeg_build" \ --pkg-config-flags="--static" \ --extra-cflags="-I$HOME/ffmpeg_build/include" \ --extra-ldflags="-L$HOME/ffmpeg_build/lib" \ --bindir="$HOME/bin" \ --enable-gpl \ --enable-libass \ --enable-libfreetype \ --enable-libmp3lame \ --enable-libopus \ --enable-libtheora \ --enable-libvorbis \ --enable-libx264 \ --enable-nonfree PATH="$HOME/bin:$PATH" make make install make distclean hash -r source ~/.profile } echo Done exit 0
install-rvm.sh
#!/usr/bin/env bash echo Installing RVM gpg key gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 --trust-model always echo Installing RVM \curl -sSL https://get.rvm.io | bash -s $1 exit 0
I won't include the other scripts for the sake of brevity. When logging into vagrant with the gui nothing seems out of the ordinary, and ffmpeg is available...but nothing else is provisioned. No RVM, no Nginx, nothing.
-
ffmpeg concat avi files loosing the audio
14 juin 2016, par Nir DiamantHey i have 2 AVI files that i want to concatenate them to one output.
the files path is written in text file (mylist.txt):
file1.avi - contain video only. file2.avi - contain video and audio.
i execute the next command:
ffmpeg -f concat -i C:\ffmpeg\mylist.txt -c copy C:\ffmpeg\output.avi
mylist.txt=
file 'C:\motionbee\ffmpeg\bin\file1.avi'
file 'C:\motionbee\ffmpeg\bin\file2.avi'
the output file is concatenate of the 2 files. but the sound from file2.avi is not there.
so how can i contact them without delete the sound???
console log:
C:\motionbee\ffmpeg\bin>ffmpeg -f concat -i C:\motionbee\ffmpeg\bin\mylist.txt - c copy C:\motionbee\ffmpeg\bin\output.avi ffmpeg version N-78949-g6f5048f Copyright (c) 2000-2016 the FFmpeg developers built with gcc 5.3.0 (GCC) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca -- enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-l ibilbc --enable-libmodplug --enable-libmfx --enable-libmp3lame --enable-libopenc ore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --ena ble-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable -libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --ena ble-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx 264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable -lzma --enable-decklink --enable-zlib libavutil 55. 19.100 / 55. 19.100 libavcodec 57. 27.101 / 57. 27.101 libavformat 57. 28.100 / 57. 28.100 libavdevice 57. 0.101 / 57. 0.101 libavfilter 6. 39.100 / 6. 39.100 libswscale 4. 0.100 / 4. 0.100 libswresample 2. 0.101 / 2. 0.101 libpostproc 54. 0.100 / 54. 0.100 Input #0, concat, from 'C:\motionbee\ffmpeg\bin\mylist.txt': Duration: N/A, start: 0.000000, bitrate: 523 kb/s Stream #0:0: Video: mpeg4 (Simple Profile) (FMP4 / 0x34504D46), yuv420p, 720 x480 [SAR 32:27 DAR 16:9], 523 kb/s, 29.97 fps, 29.97 tbr, 29.97 tbn, 30k tbc File 'C:\motionbee\ffmpeg\bin\output.avi' already exists. Overwrite ? [y/N] y Output #0, avi, to 'C:\motionbee\ffmpeg\bin\output.avi': Metadata: ISFT : Lavf57.28.100 Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 720x480 [SAR 32:27 D AR 16:9], q=2-31, 523 kb/s, 29.97 fps, 29.97 tbr, 29.97 tbn, 29.97 tbc Stream mapping: Stream #0:0 -> #0:0 (copy) Press [q] to stop, [?] for help [concat @ 0000000000452620] New audio stream 0:1 at pos:10038 and DTS:100.104s frame= 6000 fps=0.0 q=-1.0 Lsize= 13020kB time=00:03:20.23 bitrate= 532.7kbits /s speed=1.39e+003x video:12870kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.159987%
thanks.
-
Output FFMPEG progress via Node
14 juin 2016, par ErraticFoxI am building a desktop app with Node.js and Electron. This app is only client side, there is no servers and uses FFMPEG. I've seen there's a way to display the progress via PHP, but I was wondering if I was able to do this via Node.
I found this, but I can't seem to get it to output progress. The code below is what I am using for that Node Module and the console only logs [] after conversion is complete.
var inputDir = uploadFile.files[0].path var spawn = require('child_process').spawn var ffmpegBin = require('ffmpeg-static'), progressStream = require('ffmpeg-progress-stream') var params = [ '-y', '-i', inputDir, "C:\\Users\\ErraticFox\\Desktop\\output.mp3" ] ffmpeg = spawn(ffmpegBin.path, params); ffmpeg.stderr .pipe(progressStream(120)) .pipe(concat(function(data) { results = data; console.log(data) }))
-
Reading images from AXIS ip camera using OpenCV
14 juin 2016, par batumanI am trying to access AXIS IP camera from my program using OpenCV. My OpenCV version is 3.1. I follow this tutorial link.
I have all libraries installed. My following program can load mp4 video successfully. That means ffmpeg and necessary libraries are working fine.
#include
#include opencv.hpp> using namespace std; int main() { cv::VideoCapture vcap("test.mp4"); cv::Mat image; // const string address = "rtsp://root:pass@192.168.0.90/axis-media/media.amp?camera=1"; // if(!vcap.open(address)){ // std::cout << "Error opening video stream or file " << std::endl; // return -1; // } for(;;){ if(!vcap.read(image)){ std::cout << "No frame" << std::endl; cv::waitKey(0); } cv::imshow("Display", image); cv::waitKey(1); } return 0; } When I tried to access the IP Camera as follow
cv::VideoCapture vcap("rtsp://root:pass@192.168.0.90/axis-media/media.amp?camera=1");
I have the following error
GStreamer Plugin: Embedded video playback halted; module source reported: Could not open resource for reading and writing. OpenCV Error: Unspecified error (GStreamer: unable to start pipeline ) in cvCaptureFromCAM_GStreamer, file /home/Softwares/opencv/opencv/modules /videoio/src/cap_gstreamer.cpp, line 818 terminate called after throwing an instance of 'cv::Exception' what(): /home/Softwares/opencv/opencv/modules/videoio/src/cap_gstreamer. cpp:818: error: (-2) GStreamer: unable to start pipeline in function cvCaptureFromCAM_GStreamer
User is root and password is pass and ip 192.168.0.90 are all defaults.
My if config gave me
ifconfig eth0 Link encap:Ethernet HWaddr b8:2a:72:c6:b8:13 inet6 addr: fe80::ba2a:72ff:fec6:b813/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:723959 errors:0 dropped:0 overruns:0 frame:0 TX packets:116637 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:199422245 (199.4 MB) TX bytes:13701699 (13.7 MB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:24829 errors:0 dropped:0 overruns:0 frame:0 TX packets:24829 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:2502903 (2.5 MB) TX bytes:2502903 (2.5 MB) wlan0 Link encap:Ethernet HWaddr a0:a8:cd:99:92:60 UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
What could be the problem for this access to the camera?
Thanks