en en en en en en en en en en en en en en en en en en en en en en ja en en en en en en en en en en en en en ja en en en en en en az en en en en en en en en en en en en en en en sv et de en en en en fr en en en en en en en en en az en en en en en en en en en en en en en en en sv et de en en en en fr en en en en en en en en en az en en en en en en en en en en pt en en en en en en en
If you pass a video to avconv, it returns meta-data about the video, including its duration, e.g.
A search on the Ubuntu forums returned an easy way to parse the above output using Linux scripting1.
Once, I had the above data (e.g.  “00:00:03.76”) in a string, I needed to convert it to an integer value. Further research returned the following snippet of PHP code
list($hours,$mins,$secs) = explode(':',$duration); $seconds = mktime($hours,$mins,$secs) - mktime(0,0,0);
The first mktime returned a timestamp relative to the current time, so we need to subtract the number of seconds from the current timestamp at midnight. This gives us the number of seconds in our video as an integer value.
Raguet Roman, 2012, accessed  21 April 2014,  .
2012, Stack Overflow, accessed  21 April 2014, .
Posted in PHP, Video Encoding, Web DevelopmentTagged Linux, Mint, PHP, Ubuntu, VideoLeave a comment
Video Encoding with Large Files
Posted on Mar 4, 2014Mar 4, 2014 by Denis G Noonan
This week’s issue relates to encoding large video files. I had previously integrated open source software to encode video from a variety of formats to H.264 (using an mp4 container). The software worked fine with test data from small video files. Recently however, we have been testing with more realistic data from longer videos.
Soon into this stage of testing, we found that the encoding software which was running on our test server was failing.
We use the open source software ‘melt’ on Linux to do the video encoding. ‘Melt’ usually runs as a two-pass process.
So I went to look at our logs and determined that the ‘melt’ first pass in particular was failing. Next, I checked from running ‘top’ in another terminal that melt was using more and more memory and was terminating at 92% of total memory.
As I suspected that the Linux Out-Of-Memory killer had terminated the process, I went to check the kernel logs, as follows.
$ tail /var/log/kern.log kernel: [32941851.928772] Out of memory: Kill process 3318 (melt) score 927 or sacrifice child kernel: [32941851.928788] Killed process 3318 (melt) total-vm:4400676kB, anon-rss:3551936kB, file-rss:140kB
This confirms that the OOM-killer terminated the melt process as memory needs to be reclaimed to ensure that Linux could continue to run.
Now that I knew the source of the problem, first I tweaked the melt parameters to reduce its workload. However, the same problem occurred again with only a slight improvement in how far the encoding went.
Following one from this, I checked our Linux box and saw that no swap space had been allocated. From here, I could see that the solution was to configure swap memory in Linux to allow the melt process to complete.
So, we allocated 2GB of swap memory in addition to the existing 4GB of RAM and ran the encoding test again. This time, everything ran smoothly, with the swap memory being used to supplement RAM.
Posted in Video EncodingTagged Linux, Out-of-memory killer, Video EncodingLeave a comment
Follow Denis' Technology Blog on WordPress.com
How to Set up a Minikube Lab with VMware Workstation
How to install Elasticsearch on Fedora 28
Versioning in Git using Tags
Getting the Duration of a Video with PHP
Splitting a file path in PHP
Denis G Noonan on How to install Elasticsearch o…
Max on How to install Elasticsearch o…
SutoCom on Installing Laravel on Linux Mi…
Denis G Noonan on Including Autoloader and …
thenewphalls on Including Autoloader and …
How to Set up a Minikube Lab with VMware Workstation
How to install Elasticsearch on Fedora 28
Versioning in Git using Tags
Getting the Duration of a Video with PHP
Splitting a file path in PHP
Denis G Noonan on How to install Elasticsearch o…
Max on How to install Elasticsearch o…
SutoCom on Installing Laravel on Linux Mi…
Denis G Noonan on Including Autoloader and …
thenewphalls on Including Autoloader and …
Follow Denis' Technology Blog on WordPress.com
How to Set up a Minikube Lab with VMware Workstation
How to install Elasticsearch on Fedora 28
Versioning in Git using Tags
Getting the Duration of a Video with PHP
Splitting a file path in PHP
Website Powered by WordPress.com.
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.