5

Edit
I stopped using VLC and switched to GMax FLV Encoder. It does a much better job IMO.

Original post
I am sending my desktop (screen) as an H264 video stream to another machine that saves it to a file using the follwoing command lines:

Sender of the stream:

vlc -I dummy --sout='#transcode{vcodec=h264,vb=512,scale=0.5} :rtp{mux=ts,dst=192.168.0.1,port=4444}' 

Receiver of the stream:

vlc -I rc rtp://@:4444 --sout='#std{access=file,mux=ps,dst=/home/user/output.mp4}' --ipv4 

This works, but there are a few issues:

  • The file is not playable with most players.
  • VLC is able to playback the file but with some weirdness:
  • => it takes about 10 seconds before the playback actually begins.
  • => seeking doesn't work.

Can someone point me in the right direction on how to fix these issues?

EDIT: I made a little progress.

The initial delay in playback is because the player is waiting for a keyframe. By forcing the sender of the stream to create a new key-frame every 4 seconds I could decrease the delay:

:screen-fps=10 --sout='#transcode{vcodec=h264,venc=x264{keyint=40},vb=512,scale=0.5} :rtp{mux=ts,dst=192.168.0.1,port=4444}' 

The seeking problem is not solved however, but I understand it a little better. The RTP stream is saved as a file in its original streaming format, which is normally not playable as a regular video file. VLC manages to play this file, but most other players don't. So I need to convert it to a regular video file. I am currently investigating whether I can do this with ffmpeg if I provide it with an SDP file for the recorded stream.

All help is welcome!

3
  • I have no clue how to answer this question, but have you tried using a video editor and saving the file as a different format? Commented Nov 21, 2009 at 12:28
  • Yes, with ffmpeg I have attempted a repair, but it seems to reduce the entire output to a few frames, so I ended up with a 1 second video. Commented Nov 21, 2009 at 14:50
  • 2
    How is this programming related? Commented Nov 21, 2009 at 22:37

2 Answers 2

6
+300

Updating your sender command line with:

venc=x264{scenecut=20,bframes=0} 

And your client command line as:

vlc -I rc rtp://@:4444 --sout='#std{access=file,mux=mp4,dst=/tmp/output.mp4}' --ipv4 

should fix your problems. Which players did you test?

Sign up to request clarification or add additional context in comments.

4 Comments

Setting mux=mp4 is really helpful, it's a shame that it isn't mentioned the docs (videolan.org/doc/streaming-howto/en/ch03.html). Today I figured out that setting bframes=0 would result in a file that can be fixed with ffmpeg, but now this is also no longer needed thanks to the mux=mp4 setting. However, how does scenecut=20 help to fix my problem? Or is it just an optimization?
One more question: why did you leave out x264's keyint=40 setting?
Btw, I tested with Movie Player and GNOME Player on my Mint vbox. Both of these are now able to play my recordings thanks to the settings your provided. PS: Answer above questions and the bounty is yours.
"scenecut" enable Scene-cut detection that controls how aggressively to insert extra I-frames. You can change that value from -1 (disabled) to 100. Changing this value can help the encoder to find a better location for the I-frame. I didn't need "keyint" and with larger value could lead to not precise seeks.
0

Sender:

$ vlc screen:// :screen-fps=5 :screen-caching=100 --sout='#transcode{vcodec=h264,venc=x264{scenecut=20,bframes=0},vb=512,scale=0.5}:rtp{mux=ts,dst=127.0.0.1,port=1234}' VLC media player 1.1.11 The Luggage (revision exported) Blocked: call to unsetenv("DBUS_ACTIVATION_ADDRESS") Blocked: call to unsetenv("DBUS_ACTIVATION_BUS_TYPE") [0x9caf8fc] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface. Blocked: call to setlocale(6, "") Warning: call to srand(1314435080) Warning: call to rand() Blocked: call to setlocale(6, "") (process:11597): Gtk-WARNING **: Locale not supported by C library. Using the fallback 'C' locale. x264 [info]: using cpu capabilities: MMX2 Cache64 x264 [info]: profile High, level 3.2 x264 [info]: using SAR=1/1 x264 [info]: using cpu capabilities: MMX2 Cache64 x264 [info]: profile High, level 4.0 x264 [info]: frame I:1 Avg QP:16.44 size: 57235 x264 [info]: frame P:152 Avg QP:10.01 size: 2747 x264 [info]: mb I I16..4: 33.8% 2.7% 63.5% x264 [info]: mb P I16..4: 0.9% 0.0% 0.9% P16..4: 2.1% 0.4% 0.3% 0.0% 0.0% skip:95.4% x264 [info]: 8x8 transform intra:1.8% inter:44.3% x264 [info]: coded y,uvDC,uvAC intra: 45.5% 42.9% 40.5% inter: 1.5% 1.5% 1.4% x264 [info]: i16 v,h,dc,p: 45% 54% 0% 0% x264 [info]: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 41% 22% 2% 2% 2% 4% 1% 3% x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 16% 49% 13% 2% 3% 3% 5% 2% 7% x264 [info]: i8c dc,h,v,p: 43% 49% 7% 2% x264 [info]: Weighted P-Frames: Y:0.0% UV:0.0% x264 [info]: ref P L0: 85.8% 4.5% 9.1% 0.7% x264 [info]: kb/s:124.12 ^C[0x9d4ee6c] signals interface error: Caught Interrupt signal, exiting... 

Receiver:

$ vlc udp://:1234 VLC media player 1.1.11 The Luggage (revision exported) Blocked: call to unsetenv("DBUS_ACTIVATION_ADDRESS") Blocked: call to unsetenv("DBUS_ACTIVATION_BUS_TYPE") [0x8c728fc] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface. Blocked: call to setlocale(6, "") Warning: call to srand(1314469032) Warning: call to rand() Blocked: call to setlocale(6, "") (process:11707): Gtk-WARNING **: Locale not supported by C library. Using the fallback 'C' locale. libdvbpsi error (PSI decoder): TS discontinuity (received 1, expected 0) for PID 0 libdvbpsi error (PSI decoder): TS discontinuity (received 1, expected 0) for PID 66 libdvbpsi error (PSI decoder): TS discontinuity (received 6, expected 5) for PID 0 libdvbpsi error (PSI decoder): TS discontinuity (received 8, expected 7) for PID 0 libdvbpsi error (PSI decoder): TS discontinuity (received 10, expected 9) for PID 0 libdvbpsi error (PSI decoder): TS discontinuity (received 14, expected 13) for PID 0 libdvbpsi error (PSI decoder): TS discontinuity (received 0, expected 15) for PID 66 libdvbpsi error (PSI decoder): TS discontinuity (received 2, expected 1) for PID 66 libdvbpsi error (PSI decoder): TS discontinuity (received 12, expected 11) for PID 66 libdvbpsi error (PSI decoder): TS discontinuity (received 14, expected 13) for PID 66 libdvbpsi error (PSI decoder): TS discontinuity (received 0, expected 15) for PID 66 libdvbpsi error (PSI decoder): TS discontinuity (received 2, expected 1) for PID 66 libdvbpsi error (PSI decoder): TS discontinuity (received 7, expected 6) for PID 0 libdvbpsi error (PSI decoder): TS discontinuity (received 9, expected 8) for PID 0 libdvbpsi error (PSI decoder): TS discontinuity (received 11, expected 10) for PID 0 libdvbpsi error (PSI decoder): TS discontinuity (received 13, expected 12) for PID 66 libdvbpsi error (PSI decoder): TS discontinuity (received 15, expected 14) for PID 66 libdvbpsi error (PSI decoder): TS discontinuity (received 1, expected 0) for PID 0 libdvbpsi error (PSI decoder): TS discontinuity (received 8, expected 7) for PID 66 libdvbpsi error (PSI decoder): TS discontinuity (received 11, expected 10) for PID 0 libdvbpsi error (PSI decoder): TS discontinuity (received 13, expected 12) for PID 66 libdvbpsi error (PSI decoder): TS discontinuity (received 4, expected 3) for PID 0 libdvbpsi error (PSI decoder): TS discontinuity (received 8, expected 7) for PID 66 [0xb740070c] main input error: ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to 300 ms) ^C[0x8d11cec] signals interface error: Caught Interrupt signal, exiting... 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.