video - Extracting VLC IP Camera stream to raw H264 data

24
2013-08
  • PRacicot

    I'm new with streaming from VLC to a file, but I've been searching around the internet for what I'm trying to do and haven't found any relevant information. I'm currently developing a camera simulator which streams a video file in playback (since it's a simulation).

    The camera itself streams in H264 VGA (640x480), on RTSP over UDP.

    Basicly what I'm trying to do is save a stream (10 seconds) of the real camera though VLC so that this video file can be use afterwards by the simulator. In our simulator, all video files from H264 stream have the extensions H264 (example: Stream1.h264).

    To ensure myself that my video file is correctly encoded, I use MediaInfo to see the file properties, but I can't seem to be able to get the wanted properties.

    For example I tried with the encapsulation method MPEG-TS, and I got the following properties:

    General 
    ID : xxxxxxx 
    Complete name : xxx 
    Format : MPEG-TS 
    Format/Info : This information doesn't appear, why?
    File size : xx 
    Duration : xx 
    
    Format : AVC 
    Format/Info : Advanced Video Codec 
    Format profile : [email protected] 
    Format settings, CABAC : Yes 
    Format settings, ReFrames : 4 frames 
    

    But the properties that I'm looking for are:

    General 
    Complete name : xxx 
    Format : AVC 
    Format/Info : Advanced Video Codec 
    File size : xx  
    
    Format : AVC 
    Format/Info : Advanced Video Codec 
    Format profile : [email protected] 
    Format settings, CABAC : No 
    Format settings, ReFrames : 1 frame 
    
  • Answers
  • slhck

    You can always extract the raw H.264 stream from an encapsulated file. I would suggest encapsulating to MP4, and then you can use MP4Box to do:

    mp4box -raw 1 video.mp4
    

    This will create the file video_track1.h264, which should match your specifications. I tried this on one file I had, and this was my result – I think that's the avc1 respresentation you're looking for:

    General
    Complete name                            : xxx
    Format                                   : AVC
    Format/Info                              : Advanced Video Codec
    File size                                : ...
    
    Video
    Format                                   : AVC
    Format/Info                              : Advanced Video Codec
    Format profile                           : [email protected]
    Format settings, CABAC                   : Yes
    Format settings, ReFrames                : 5 frames
    

  • Related Question

    video - How to stream multiple files on demand in VLC?
  • romkyns

    Is there any way at all that I can set up VLC on a server PC in such a way that I can access a list of all my videos from another PC, and pick one to be streamed on demand?

    I've been pointed at this streaming guide (pdf), but it's pretty useless. For a start, most of the menus in those screenshots don't match the actual current version VLC, and then it sort of assumes you already know what you're doing.

    So far I managed to figure out how to stream a single file, which I must choose before watching on the server PC - pretty useless if you ask me! The impenetrable "UI" doesn't help either...

    (P.S. The reason I'm going for streaming rather than the very simple to set up network drive is described in this question)


  • Related Answers
  • joe

    VideoLAN Manager is a small media manager designed to control multiple streams with only one instance of VLC. It allows multiple streaming and video on demand (VoD). This manager being a new feature, it can only be controlled by the telnet interface or the http interface.

    Steps : http://www.videolan.org/doc/streaming-howto/en/ch05.html

    For Exanmple

    vlm configuration files.

    new channel1 broadcast enabled
    setup channel1 input http://host.mydomain/movie.mpeg
    setup channel1 output #rtp{mux=ts,dst=239.255.1.1,sap,name="Channel 1"}
    
    new channel2 broadcast enabled
    setup channel2 input rtp://@239.255.12.42
    setup channel2 output #rtp{mux=ts,dst=239.255.1.2,sap,name="Channel 2"}
    
    control channel1 play
    control channel2 play
    

    Video On Demand Basic example

    First launch the vlc

    % vlc --ttl 12 -vvv --color -I telnet --telnet-password videolan --rtsp-host 0.0.0.0:5554

    Then you connect to the vlc telnet interface and create the vod object

    new Test vod enabled
    setup Test input my_video.mpg
    

    You can access to the stream with:

    % vlc rtsp://server:5554/Test
    
  • 8088

    In VLC :

    Click “File > Open File” to bring up the “Open” dialog box.

    alt text

    Click on the “Browse” button to bring up a standard Windows file selection box. Select the file you want to play. Then click “Open”. We've selected multiple files so VLC will build a playlist.

    alt text

    Your selection should appear in the text box next to the “Browse” button. Click the checkbox for “Stream Output” and then click the button “Settings.”

    alt text

    Check the box next to “Play Locally” under “Output Methods.” When streaming to another system you don't have to play the file on the server, but we will use this option to visually confirm that our video is playing properly before trying to access the stream from another computer.

    Check the box marked “UDP” and type in the IP address of the computer you want to stream the file to. Then click “OK”. The file is ready to play so click “OK” in the “Open” dialog box too.

    [This step did not work with my .flv video. Though the server was playing the video locally, the client (localhost:8181) did not play the video. Corrective action was to uncheck "UDP" checkbox" (this could be because my UDP transport protocol was not working on my laptop or MPEG-TS was not a corrective format container for streaming. MPEG-TS was the only format container or encapsulation method available when "UDP" is selected) and click "HTTP" checkbox, then set "Address" as 127.0.0.1 and port as "8181". Now select "ASF" as the encapsulation method and keep the rest of the "Stream output" dialog defaults. Click "OK" to go bakc to the "Open" dialog box and then click "OK" in the "Open" dialog box to start playing the video.]

    alt text

    The video or audio file should begin playing on the computer. The last thing to do before switching to your second computer is to turn on VLC’s web interface by clicking “Settings > Add Interface > Web Interface”.

    alt text

    Open VLC on your second machine. We are using a Linux machine.

    Click on “File > Open Network Stream”. UDP is already selected so you just need to click the “OK” button and VLC will start playing your stream.

    alt text

    Now that the stream is successfully playing on your computer you can open up a web browser to control VLC remotely. Type “http://:8080/” into the address bar. The web browser will present you with all of the controls you need to manage playlists and playback remotely.

    Source