I'm using ffmpeg on android and i have encountered and error, that does not occur when i'm using the library on my linux VM. I'm using FFmpeg Static Builds, from here. I am using the stable 3.1.5 x86_64 build on the emulator and the linux VM..
The emulator i'm using is genymotion API 22 nexus 6p, linux vm is ubuntu 16.04. The problem also occurs on my physical phone which is nexus 5 running cyanogenmod 6, API 22.
Android Log:
ffmpeg version 3.1.5-static http://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 5.4.1 (Debian 5.4.1-2) 20160904
configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-5 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libass --enable-libebur128 --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg
libavutil 55. 28.100 / 55. 28.100
libavcodec 57. 48.101 / 57. 48.101
libavformat 57. 41.100 / 57. 41.100
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 47.100 / 6. 47.100
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 1.100 / 2. 1.100
libpostproc 54. 0.100 / 54. 0.100
[tcp @ 0x4029cc0] Failed to resolve hostname r8---sn-ivuoxu-ua8l.googlevideo.com: Name or service not known
https://r8---sn-ivuoxu-ua8l.googlevideo.com/videoplayback?mime=video/mp4&ipbits=0&ratebypass=yes&requiressl=yes&dur=338.175&ms=au&mt=1477750809&fexp=9446761&mv=m&itag=22&mm=31&mn=sn-ivuoxu-ua8l&key=yt6&id=o-ANbaVtkKQuOcWMW9UrYRp47rRSKKc-1d3AGaTRwYVS6z&expire=1477772565&pcm2cms=yes&ip=5.29.246.6&lmt=1470910909244041&ei=tbAUWJvkHsjIiwahzIu4AQ&pl=26&source=youtube&sparams=dur,ei,id,initcwndbps,ip,ipbits,itag,lmt,mime,mm,mn,ms,mv,pcm2cms,pl,ratebypass,requiressl,source,upn,expire&initcwndbps=2532500&upn=jtb8x3K3rqs&signature=D1E8DF4167175F11BE67DE0141B459715047AFDD.69E5499B1345F3A7F2AB4B938F6C05055C3144AB: Input/output error
Here is the log from linux VM:
ffmpeg version 3.1.5-static http://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 5.4.1 (Debian 5.4.1-2) 20160904
configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-5 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libass --enable-libebur128 --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg
libavutil 55. 28.100 / 55. 28.100
libavcodec 57. 48.101 / 57. 48.101
libavformat 57. 41.100 / 57. 41.100
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 47.100 / 6. 47.100
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 1.100 / 2. 1.100
libpostproc 54. 0.100 / 54. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'https://r8---sn-ivuoxu-ua8l.googlevideo.com/videoplayback?mime=video/mp4&ipbits=0&ratebypass=yes&requiressl=yes&dur=338.175&ms=au&mt=1477750809&fexp=9446761&mv=m&itag=22&mm=31&mn=sn-ivuoxu-ua8l&key=yt6&id=o-ANbaVtkKQuOcWMW9UrYRp47rRSKKc-1d3AGaTRwYVS6z&expire=1477772565&pcm2cms=yes&ip=5.29.246.6&lmt=1470910909244041&ei=tbAUWJvkHsjIiwahzIu4AQ&pl=26&source=youtube&sparams=dur,ei,id,initcwndbps,ip,ipbits,itag,lmt,mime,mm,mn,ms,mv,pcm2cms,pl,ratebypass,requiressl,source,upn,expire&initcwndbps=2532500&upn=jtb8x3K3rqs&signature=D1E8DF4167175F11BE67DE0141B459715047AFDD.69E5499B1345F3A7F2AB4B938F6C05055C3144AB':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2016-08-11 10:21:33
Duration: 00:05:38.13, start: 0.000000, bitrate: 555 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 426 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc (default)
Metadata:
creation_time : 2016-08-11 10:21:33
handler_name : ISO Media file produced by Google Inc.
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)
Metadata:
creation_time : 2016-08-11 10:21:33
handler_name : ISO Media file produced by Google Inc.
[ipod @ 0x5264580] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Output #0, ipod, to 'output.m4a':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
encoder : Lavf57.41.100
Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, 125 kb/s (default)
Metadata:
creation_time : 2016-08-11 10:21:33
handler_name : ISO Media file produced by Google Inc.
Stream mapping:
Stream #0:1 -> #0:0 (copy)
Press [q] to stop, [?] for help
size= 5241kB time=00:05:38.12 bitrate= 127.0kbits/s speed=35.4x
video:0kB audio:5184kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.112068%
The command im using :
./ffmpeg -i 'https://r8---sn-ivuoxu-ua8l.googlevideo.com/videoplayback?mime=video/mp4&ipbits=0&ratebypass=yes&requiressl=yes&dur=338.175&ms=au&mt=1477750809&fexp=9446761&mv=m&itag=22&mm=31&mn=sn-ivuoxu-ua8l&key=yt6&id=o-ANbaVtkKQuOcWMW9UrYRp47rRSKKc-1d3AGaTRwYVS6z&expire=1477772565&pcm2cms=yes&ip=5.29.246.6&lmt=1470910909244041&ei=tbAUWJvkHsjIiwahzIu4AQ&pl=26&source=youtube&sparams=dur,ei,id,initcwndbps,ip,ipbits,itag,lmt,mime,mm,mn,ms,mv,pcm2cms,pl,ratebypass,requiressl,source,upn,expire&initcwndbps=2532500&upn=jtb8x3K3rqs&signature=D1E8DF4167175F11BE67DE0141B459715047AFDD.69E5499B1345F3A7F2AB4B938F6C05055C3144AB' -vn -acodec copy output.m4a
My Question is does android make some kind of restriction on static libraries? What is causing the issue ? I have no problem pinging the host right after i try to run the command, and it working fine !
ping -c 4 r8---sn-ivuoxu-ua8l.googlevideo.com
PING r8.sn-ivuoxu-ua8l.googlevideo.com (213.57.23.19) 56(84) bytes of data.
64 bytes from 213.57.23.19: icmp_seq=1 ttl=57 time=12.6 ms
64 bytes from 213.57.23.19: icmp_seq=2 ttl=57 time=22.3 ms
64 bytes from 213.57.23.19: icmp_seq=3 ttl=57 time=23.1 ms
64 bytes from 213.57.23.19: icmp_seq=4 ttl=57 time=27.1 ms
--- r8.sn-ivuoxu-ua8l.googlevideo.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 12.689/21.322/27.103/5.300 ms
Some observation that i have made from my testing :
- The problem is not with the internet, since i can ping the host right after without problem.
- The problem is not with the url, i have tried with this one and i'm getting the same error
https://video-cdn.buzzfeed.com/13800/mp4_640x640/1478210253
- The library is working fine on the linux VM, but not on the android, this may be an error with the implemetation(most definatly not), packaging (maybe), or android itself.
MAJOR EDIT :
I have just reread the readme file for the libraries and i noticed this:
A limitation of statically linking glibc is the loss of DNS resolution. Installing
nscd through your package manager will fix this or you can use
"ffmpeg -i http://<ip address here>/" instead of "ffmpeg -i http://example.com/"
I gave found this function from c# , that might do what I need, :dns lookup msdn
ping r8---sn-ivuoxu-ua8l.googlevideo.com
? That works on my (vanilla) Android 6.