hypeapps / Endoscope

Endoscope lets you to stream live video between android devices over Wi-Fi! 📱📲
GNU General Public License v3.0
674 stars 188 forks source link

ffplay works but vlc doesn't #20

Open hs79hs opened 7 years ago

hs79hs commented 7 years ago

Hi, thanks for your great work. It works between my two phones. And I also can use ffplay on my computer to view them. But the strange thing is that vlc on my computer cannot play. Everytime it will report error after received nothing for more than 10 seconds.

And I tried to use ffmpeg to record the rtsp link, but the recorded video cannot be played by both vlc and ffplay if without transcode, the ffmpeg command likes this, ffmpeg.exe -i rtsp://192.168.0.10:8086 -c copy test.ts

It's ok to play if ffmpeg transcodes like this, ffmpeg.exe -i rtsp://192.168.0.10:8086 test.ts

It seems something is wrong with the codec. Any suggestions? Thanks.

hs79hs commented 7 years ago

Another problem with my two phones is that only 480x320 and 320x240 work, 800x480 or 640x480 doesn't work. Is it because of the CPU capacity of the phone or the network capacity?

aario commented 7 years ago

Same here Debian Jessie

ffmpeg version 3.2.4-1~bpo8+1 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 4.9.2 (Debian 4.9.2-10)
  configuration: --prefix=/usr --extra-version='1~bpo8+1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --disable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 34.101 / 55. 34.101
  libavcodec     57. 64.101 / 57. 64.101
  libavformat    57. 56.101 / 57. 56.101
  libavdevice    57.  1.100 / 57.  1.100
  libavfilter     6. 65.100 /  6. 65.100
  libavresample   3.  1.  0 /  3.  1.  0
  libswscale      4.  2.100 /  4.  2.100
  libswresample   2.  3.100 /  2.  3.100
  libpostproc    54.  1.100 / 54.  1.100
VLC media player 2.2.4 Weatherwax (revision 2.2.3-37-g888b7e89)
VLC version 2.2.4 Weatherwax (2.2.3-37-g888b7e89)
Compiled by sebastian on rigel (Jun  5 2016 15:54:01)
Compiler: gcc version 4.9.2 (Debian 4.9.2-10)
This program comes with NO WARRANTY, to the extent permitted by law.
You may redistribute it under the terms of the GNU General Public License;
see the file named COPYING for details.
Written by the VideoLAN team; see the AUTHORS file.

Both players connect and trigger the app to start the camera but they cannot play. The ffplay says:

[rtsp @ 0x7f939c0008c0] UDP timeout, retrying with TCP   0B f=0/0   
[rtsp @ 0x7f939c0008c0] Nonmatching transport in server reply=0/0   
[rtsp @ 0x7f939c0008c0] Could not find codec parameters for stream 0 (Video: h264, none): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, rtsp, from 'rtsp://192.168.0.124:8086':
  Metadata:
    title           : Unnamed
    comment         : N/A
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264, none, 90k tbr, 90k tbn, 180k tbc
[rtsp @ 0x7f939c0008c0] UDP timeout, retrying with TCP   0B f=0/0   
[rtsp @ 0x7f939c0008c0] Nonmatching transport in server reply=0/0   
[rtsp @ 0x7f939c0008c0] UDP timeout, retrying with TCP   0B f=0/0   
[rtsp @ 0x7f939c0008c0] Nonmatching transport in server reply=0/0   
aario commented 7 years ago

I believe the problem is that the software doesn't send stream info. mplayer says:

Playing rtsp://192.168.0.124:8086.
Forced lavf RTSP input demuxer
Detected file format: libavformat
[rtsp @ 0x7f07be7bbb40]UDP timeout, retrying with TCP
[rtsp @ 0x7f07be7bbb40]Nonmatching transport in server reply
[rtsp @ 0x7f07be7bbb40]Could not find codec parameters (Video: h264)
[rtsp @ 0x7f07be7bbb40]Estimating duration from bitrate, this may be inaccurate
LAVF_header: av_find_stream_info() failed
Opening as detected format "libavformat" failed.
Failed to recognize file format.

Exiting... (End of file)

Emphasize on: LAVF_header: av_find_stream_info() failed

hs79hs commented 7 years ago

Are you using 480x320 or 320x240? By my tests, they can work while using ffplay, but vlc doesn't.

High resolutions don't work for both ffplay and vlc, because if resolution.X>=640, libstreaming will use MediaRecorder. but MediaRecorder cannot start if setting its outputFile to pipe created by ParcelFileDescriptor.createPipe().

I tried to still use MediaCodec for high resolution, but also failed.

aario commented 7 years ago

I tried with all resolutions and both ffplay and vlc and neither worked. Two things came to my mind: Either Debian Jessie's version of some libraries lacks some dependency on compilation time that prevents these two software to read size information of this specific format of video or you missed one step in your app which initializes the stream with size information. Something like: initMetaInfo(width, height, ....); Wish I could find some time fix this problem your app is cool and I want to use it to attach my mobile phone to an RC car and then I can have First Person View :-D

montvid commented 7 years ago

800x480 and 640x480 don't work on ubuntu vlc but the lower resolutions work.