3

I'm programming a small software for the remote use of a Sony camera (I use QX1 but the model should be irrelevant) in VB.net. I could make pictures by sending the JSON-commands to the camera and also could start the liveview-stream with the method "startLiveview" wrapped in a JSON-command. In return I get the address to download the livestream, like http://192.168.122.1:8080/liveview/liveviewstream (wrapped in a JSON-answer).

According to the Sony CameraRemote-API-reference this is a stream which contains some header-data and the single jpeg-data. But it seems not to be a MJPEG-stream. I could past the livestream-link to my browser and it starts to infinitely download the livestream. I could not show the stream with a MJPEG-stream player like VLC.

My question is, how can I filter out the jpeg-data with VB.net or how can I show the livestream.

A similar question was already posted at an older question but without any reply. Therefore I'm trying it again.

Community
  • 1
  • 1
user5068404
  • 43
  • 2
  • 6

4 Answers4

2

This is my way, I use ffserver to make the video stream-able. this is myconfig for ffserver config (server.conf):

Port 8090
BindAddress 0.0.0.0
MaxHTTPConnections 2000
MaxClients 1000
MaxBandwidth 10000

CustomLog -

<Feed feed1.ffm>
 File /tmp/feed1.ffm
 FileMaxSize 1G
 ACL allow 127.0.0.1
</Feed>

<Stream cam.webm>
  Feed feed1.ffm
  Format webm

  VideoCodec libvpx
  VideoSize vga
  VideoFrameRate 25
  AVOptionVideo flags +global_header  

  StartSendOnKey
  NoAudio
  preroll 5
  VideoBitRate 400
</Stream>

<Stream status.html>
  Format status
  ACL allow localhost
  ACL allow 192.168.0.0 192.168.255.255
</Stream>

And then I run the ffserver with that config:

ffserver -f server.conf 

And then encode the video from sony liveview, and broadcast via ffserver:

ffmpeg -i http://192.168.122.1:8080/liveview/liveviewstream -vcodec libvpx -fflags nobuffer -an http://127.0.0.1:8090/feed1.ffm

After that you can stream liveview from the address localhost:8090/cam.webm

  • Ohh, that sounds good. But unfortunately ffserver only exists for Linux, as far as I could google. Is there a way to use it under Windows? – user5068404 Jul 04 '15 at 07:56
1

(I use my laptop with linux in a terminal)

  1. Install GSTREAMER:

sudo apt-get install libgstreamer1.0-0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-doc gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1.0-pulseaudio

  1. fix the parameters of your camera to enable the control via Smartphone, for example the ssd of my camera on my network is DIRECT-dpC3:DSC-RX100M5A

  2. Use Wifi to connect your computer directly to your camera

  3. Tell your camera to begin liveView with this command:

    curl http://192.168.122.1:10000/sony/camera -X POST -H 'Content- type:application/json' --data '{ "method": "startLiveview", "params": [], "id": 1, "version": "1.0"}'

  4. Note the response of the camera is an URL: mine is:

    {"id":1,"result":["http://192.168.122.1:60152/liveviewstream?%211234%21%2a%3a%2a%3aimage%2fjpeg%3a%2a%21%21%21%21%21"]}

  5. Tell gstreamer to use this URL:

    gst-launch-1.0 souphttpsrc location=http://192.168.122.1:60152/liveviewstream?%211234%21%2a%3a%2a%3aimage%2fjpeg%3a%2a%21%21%21%21%21 ! jpegdec ! autovideosink

7; Enjoy ;-)

jano59
  • 11
  • 1
0

I try to use ffmpeg to process the streaming, and success to save streaming as flv file. I use this code on terminal (I use UNIX) and I success save the file as flv file:

ffmpeg -i http://192.168.122.1:8080/liveview/liveviewstream -vcodec flv -qscale 1 -an output.flv

Maybe you can modify or optimize it as you needed.

  • Thanks. It helps only a little bit. In the output of ffmpeq I could read the source is a "mjpeg, yuvj422p(pc, bt470bg/unknown/unknown) " -stream. I'm not sure what this means. How can I play such a stream with VB.net? – user5068404 Jul 02 '15 at 17:34
  • I'm not VB.net programmer, I'm not sure how to do it on VB.net but the main idea is to stream via network on VB.net. I can stream the video in browser or vlc player. I use ffserver. – Bayu Metalkoholic Jul 03 '15 at 01:18
0

In VLC works for me adding .mjpg to URL try this. Wait for sec and should be played http://192.168.122.1:8080/liveview/liveviewstream.mjpg