<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>logIt &#187; ffmpeg</title>
	<atom:link href="https://lakm.us/logit/tag/ffmpeg/feed/" rel="self" type="application/rss+xml" />
	<link>https://lakm.us/logit</link>
	<description>Log Around The Clock</description>
	<lastBuildDate>Sat, 06 Jun 2015 14:17:37 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Cross-Compiling for Ubuntu ARM by ffmpeg Example</title>
		<link>https://lakm.us/logit/2012/11/cross-compiling-ubuntu-arm-ffmpeg/</link>
		<comments>https://lakm.us/logit/2012/11/cross-compiling-ubuntu-arm-ffmpeg/#comments</comments>
		<pubDate>Mon, 05 Nov 2012 10:02:03 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[ARM Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[ARMv7]]></category>
		<category><![CDATA[BeagleBoard]]></category>
		<category><![CDATA[compile]]></category>
		<category><![CDATA[ffmpeg]]></category>
		<category><![CDATA[make-install]]></category>

		<guid isPermaLink="false">http://lakm.us/logit/?p=409</guid>
		<description><![CDATA[This has been a delayed post since I only figure out how to solve configure error just now. It wasn&#8217;t really necessary to cross-compile last year because compiling ffmpeg directly on the ARM-board finished overnight (despite the low CPU). Anyway, in this post I&#8217;m still using the board to easily retrieve package dependencies from Ubuntu [...]]]></description>
				<content:encoded><![CDATA[<p>This has been a delayed post since I only figure out how to solve <code>configure</code> error just now. It wasn&#8217;t really necessary to cross-compile last year because compiling <code><a href="https://ffmpeg.org/" title="FFMPEG" target="_blank">ffmpeg</a></code> directly on the ARM-board finished overnight (despite the low CPU). Anyway, in this post I&#8217;m still using the board to easily retrieve package dependencies from Ubuntu ARM repository. Toolchain used is <code>arm-linux-gnueabi-gcc-</code>. The following steps will apply in general:</p>
<ol>
<li> download source file (that is <code>ffmpeg</code> in this example)</li>
<li>retrieve development library/build dependecies</li>
<li>place header files and dependency libraries into toolchain path</li>
<li><code>configure</code> with toolchain</li>
<li><code>make</code> and create <code>.deb</code> installer package with <code>checkinstall</code></li>
</ol>
<div class="wp-caption aligncenter" style="width: 460px"><img alt="cross-compile-desktop-and-arm-board-illustration.png" src="../../../../images/cross-compile-desktop-and-arm-board-illustration.png" title="cross-compile: what&#039;s done on desktop &#038; what&#039;s done on ARM-board" width="350" height="207" /><p class="wp-caption-text">cross-compile: Illustration of what&#039;s done on ARM-board and what&#039;s  done on desktop</p></div>
<p>Prior to anything, install <a href="http://www.linaro.org/" title="Linaro" target="_blank">Linaro</a> toolchain by adding their repo first:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> add-apt-repository ppa:linaro-maintainers<span style="color: #000000; font-weight: bold;">/</span>toolchain
$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> gcc-arm-linux-gnueabi</pre></div></div>

<p>A complete guide on how to compile ffmpeg can be found in their <a href="https://ffmpeg.org/trac/ffmpeg/wiki/UbuntuCompilationGuideLucid" title="Compile FFmpeg on Ubuntu Lucid Lynx 10.04 LTS" target="_blank">wiki</a>. It applies generally. So, I&#8217;ll just skip to following <code>configure</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>ubuntu-desktop<span style="color: #7a0874; font-weight: bold;">&#93;</span>$ .<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--cross-prefix</span>=arm-linux-gnueabi- <span style="color: #660033;">--enable-cross-compile</span> <span style="color: #660033;">--target-os</span>=linux <span style="color: #660033;">--arch</span>=arm  <span style="color: #660033;">--cpu</span>=cortex-a8 <span style="color: #660033;">--extra-cflags</span>=<span style="color: #ff0000;">'-march=armv7-a -mfpu=neon -mfloat-abi=softfp'</span> <span style="color: #660033;">--enable-libtheora</span></pre></div></div>

<p><span id="more-409"></span></p>
<p>As an example, the above configure requires <a href="http://www.theora.org/downloads/" title="Theora" target="_blank">Theora</a> libraries. <code><a href="http://packages.ubuntu.com/lucid/libtheora-dev" title="http://packages.ubuntu.com/oneiric/libtheora-dev" target="_blank">libtheora-dev</a></code> itself requires <code>libogg-dev</code>. Use <code>apt-get</code> on the board to get them from Ubuntu ARM repository. Get the <code>.deb</code> files from <code>/var/cache/apt/archives/</code> of the ARM-board to your desktop and extract them as <code>root</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>ubuntu-desktop<span style="color: #7a0874; font-weight: bold;">&#93;</span>$ <span style="color: #c20cb9; font-weight: bold;">dpkg</span> <span style="color: #660033;">-x</span> libogg-dev_1.2.2~dfsg-1ubuntu1_armel.deb <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>cross-compile
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>ubuntu-desktop<span style="color: #7a0874; font-weight: bold;">&#93;</span>$ <span style="color: #c20cb9; font-weight: bold;">dpkg</span> <span style="color: #660033;">-x</span> libtheora-dev_1.1.1+dfsg.1-<span style="color: #000000;">3</span>_armel.deb <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>cross-compile</pre></div></div>

<p>The above <code>/usr/local/cross-compile</code> is just a temporary directory. The toolchain needs header files and dependency libraries to be placed inside <code>/usr/arm-linux-gnueabi/include/</code> and <code>/usr/arm-linux-gnueabi/lib/</code> consecutively. In my case I created the following link for header&#8217;s <code>include</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>ubuntu-desktop<span style="color: #7a0874; font-weight: bold;">&#93;</span>$ <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>arm-linux-gnueabi<span style="color: #000000; font-weight: bold;">/</span>include
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>ubuntu-desktop<span style="color: #7a0874; font-weight: bold;">&#93;</span>$ <span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>cross-compile<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>include<span style="color: #000000; font-weight: bold;">/</span>theora
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>ubuntu-desktop<span style="color: #7a0874; font-weight: bold;">&#93;</span>$ <span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>cross-compile<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>include<span style="color: #000000; font-weight: bold;">/</span>ogg</pre></div></div>

<p>and copied these from <code>/usr/local/cross-compile/usr/lib</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">libogg.a
libogg.so
libtheora.a
libtheoradec.a
libtheoradec.la
libtheoradec.so
libtheoraenc.a
libtheoraenc.la
libtheoraenc.so
libtheora.la
libtheora.so</pre></div></div>

<p>After successful <code>configure</code>, run <code>make</code> (this will take some time), and then pack the whole working directory to the ARM-board. Instead of doing <code>make install</code> in the ARM-board, use <code>checkinstall</code> to install and create the <code>.deb</code> package. This way we can make use of <code>dpkg</code> to uninstall or re-install in the manner of package manager.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>beagleboard<span style="color: #7a0874; font-weight: bold;">&#93;</span>$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> checkinstall <span style="color: #660033;">--pkgname</span>=<span style="color: #c20cb9; font-weight: bold;">ffmpeg</span> <span style="color: #660033;">--pkgversion</span>=<span style="color: #ff0000;">&quot;5:<span style="color: #007800;">$(./version.sh)</span>&quot;</span> \
     <span style="color: #660033;">--backup</span>=no <span style="color: #660033;">--deldoc</span>=<span style="color: #c20cb9; font-weight: bold;">yes</span> <span style="color: #660033;">--default</span></pre></div></div>

<p>Please mind that even if we put &#8220;<code>--install=no</code>&#8220;, the above <code>checkinstall</code> will overwrite all <code>ffmpeg</code> binaries in <code>/usr/local/bin/</code>. This is the reason why I move the process to the ARM-board: to keep other running version on my desktop stays as it is.</p>
<p>Check the test of streaming from our cross-compiled <code>ffmpeg</code> in previous <a href="./2012/11/simple-ffmpeg-udp-video-streaming-from-beagleboard-running-ubuntu" title="Simple FFMPEG UDP Video Streaming" target="_blank">post</a>.</p>
<h1>A Little History</h1>
<p>When first attempt to <code>configure</code> exited with <code>ERROR: libtheora not found</code>, I found the following test failed in the output log:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">$ arm<span style="color: #339933;">-</span>linux<span style="color: #339933;">-</span>gnueabi<span style="color: #339933;">-</span>gcc <span style="color: #339933;">-</span>D_ISOC99_SOURCE <span style="color: #339933;">-</span>D_FILE_OFFSET_BITS<span style="color: #339933;">=</span><span style="color: #0000dd;">64</span> <span style="color: #339933;">-</span>D_LARGEFILE_SOURCE <span style="color: #339933;">-</span>D_POSIX_C_SOURCE<span style="color: #339933;">=</span><span style="color: #0000dd;">200112</span> <span style="color: #339933;">-</span>D_XOPEN_SOURCE<span style="color: #339933;">=</span><span style="color: #0000dd;">600</span> <span style="color: #339933;">-</span>march<span style="color: #339933;">=</span>armv7<span style="color: #339933;">-</span>a <span style="color: #339933;">-</span>mfpu<span style="color: #339933;">=</span>neon <span style="color: #339933;">-</span>mfloat<span style="color: #339933;">-</span>abi<span style="color: #339933;">=</span>softfp <span style="color: #339933;">-</span>mcpu<span style="color: #339933;">=</span>cortex<span style="color: #339933;">-</span>a8 <span style="color: #339933;">-</span>std<span style="color: #339933;">=</span>c99 <span style="color: #339933;">-</span>fomit<span style="color: #339933;">-</span>frame<span style="color: #339933;">-</span>pointer <span style="color: #339933;">-</span>marm <span style="color: #339933;">-</span>pthread <span style="color: #339933;">-</span>E <span style="color: #339933;">-</span>o <span style="color: #339933;">/</span>tmp<span style="color: #339933;">/</span>ffconf.<span style="color: #202020;">UdYctJgq</span>.<span style="color: #202020;">o</span> <span style="color: #339933;">/</span>tmp<span style="color: #339933;">/</span>ffconf.<span style="color: #202020;">mwXpf9Tl</span>.<span style="color: #202020;">c</span>
...
<span style="color: #339933;">/</span>usr<span style="color: #339933;">/</span>lib<span style="color: #339933;">/</span>gcc<span style="color: #339933;">/</span>arm<span style="color: #339933;">-</span>linux<span style="color: #339933;">-</span>gnueabi<span style="color: #339933;">/</span>4.6.1<span style="color: #339933;">/</span>..<span style="color: #339933;">/</span>..<span style="color: #339933;">/</span>..<span style="color: #339933;">/</span>..<span style="color: #339933;">/</span>arm<span style="color: #339933;">-</span>linux<span style="color: #339933;">-</span>gnueabi<span style="color: #339933;">/</span>bin<span style="color: #339933;">/</span>ld<span style="color: #339933;">:</span> cannot find <span style="color: #339933;">-</span>ltheoraenc
<span style="color: #339933;">/</span>usr<span style="color: #339933;">/</span>lib<span style="color: #339933;">/</span>gcc<span style="color: #339933;">/</span>arm<span style="color: #339933;">-</span>linux<span style="color: #339933;">-</span>gnueabi<span style="color: #339933;">/</span>4.6.1<span style="color: #339933;">/</span>..<span style="color: #339933;">/</span>..<span style="color: #339933;">/</span>..<span style="color: #339933;">/</span>..<span style="color: #339933;">/</span>arm<span style="color: #339933;">-</span>linux<span style="color: #339933;">-</span>gnueabi<span style="color: #339933;">/</span>bin<span style="color: #339933;">/</span>ld<span style="color: #339933;">:</span> cannot find <span style="color: #339933;">-</span>ltheoradec
<span style="color: #339933;">/</span>usr<span style="color: #339933;">/</span>lib<span style="color: #339933;">/</span>gcc<span style="color: #339933;">/</span>arm<span style="color: #339933;">-</span>linux<span style="color: #339933;">-</span>gnueabi<span style="color: #339933;">/</span>4.6.1<span style="color: #339933;">/</span>..<span style="color: #339933;">/</span>..<span style="color: #339933;">/</span>..<span style="color: #339933;">/</span>..<span style="color: #339933;">/</span>arm<span style="color: #339933;">-</span>linux<span style="color: #339933;">-</span>gnueabi<span style="color: #339933;">/</span>bin<span style="color: #339933;">/</span>ld<span style="color: #339933;">:</span> cannot find <span style="color: #339933;">-</span>logg</pre></div></div>

<p>What was inside the above temporary file (<code>/tmp/ffconf.mwXpf9Tl.c</code>):</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#include &lt;theora/theoraenc.h&gt;</span>
<span style="color: #993333;">int</span> x<span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>You can run that test to check whether all dependencies are met.</p>
]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2012/11/cross-compiling-ubuntu-arm-ffmpeg/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Simple ffmpeg UDP Video Streaming (from BeagleBoard running Ubuntu)</title>
		<link>https://lakm.us/logit/2012/11/simple-ffmpeg-udp-video-streaming-from-beagleboard-running-ubuntu/</link>
		<comments>https://lakm.us/logit/2012/11/simple-ffmpeg-udp-video-streaming-from-beagleboard-running-ubuntu/#comments</comments>
		<pubDate>Mon, 05 Nov 2012 09:04:49 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[ARM Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[ARMv7]]></category>
		<category><![CDATA[BeagleBoard]]></category>
		<category><![CDATA[ffmpeg]]></category>
		<category><![CDATA[streaming]]></category>
		<category><![CDATA[VLC]]></category>

		<guid isPermaLink="false">http://lakm.us/logit/?p=406</guid>
		<description><![CDATA[I really mean simple, this is a one command line UDP stream from the BeagleBoard (running Ubuntu ARM) to my desktop (IP address 192.168.1.19 in this example), the source video is an FLV file inside the ARM-board: $ ffmpeg -i UNIQLO_MIXPLAY.flv -v 0 -vcodec mpeg4 -f mpegts udp:192.168.1.19:1234 Although it&#8217;s a break-dance video, it plays [...]]]></description>
				<content:encoded><![CDATA[<p>I really mean simple, this is a one command line UDP stream from the BeagleBoard (running Ubuntu ARM) to my desktop (IP address <code>192.168.1.19</code> in this example), the source video is an FLV file inside the ARM-board:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">ffmpeg</span> <span style="color: #660033;">-i</span> UNIQLO_MIXPLAY.flv <span style="color: #660033;">-v</span> <span style="color: #000000;">0</span> <span style="color: #660033;">-vcodec</span> mpeg4 <span style="color: #660033;">-f</span> mpegts udp:192.168.1.19:<span style="color: #000000;">1234</span></pre></div></div>

<div class="wp-caption aligncenter" style="width: 460px"><img alt="ffmpeg-cross-compiled-flv-video-udp-streaming-test.jpg" src="../../../../images/ffmpeg-cross-compiled-flv-video-udp-streaming-test.jpg" title="ffmpeg streaming from BeagleBoard played by VLC on the desktop" width="420" height="365" /><p class="wp-caption-text">ffmpeg streaming from BeagleBoard played by VLC on the desktop</p></div>
<p>Although it&#8217;s a break-dance video, it plays uninterrupted, without any break. </p>
<p>Here is how my desktop see the stream with <a href="http://www.videolan.org/vlc/" title="VLC" target="_blank">VLC player</a>:</p>
<div class="wp-caption aligncenter" style="width: 460px"><img alt="vlc-simple-udp-stream-test.png" src="../../../../images/vlc-simple-udp-stream-test.png" title="VLC setup (on the desktop) to play the UDP stream" width="354" height="100" /><p class="wp-caption-text">VLC setup (on the desktop) to play the UDP stream</p></div>
<p>With less documentation, a more complex setup with integration to <a href="http://www.wowza.com/" title="Wowza" target="_blank">Wowza Media Server</a> is available on my <a href="https://github.com/bandono/zoom-camera-board" title="zoom camera board" target="_blank">github</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2012/11/simple-ffmpeg-udp-video-streaming-from-beagleboard-running-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
