Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

How to stream image ? #653

Open
Yaya859 opened this issue Jun 26, 2020 · 10 comments
Open

How to stream image ? #653

Yaya859 opened this issue Jun 26, 2020 · 10 comments

Comments

@Yaya859
Copy link

Yaya859 commented Jun 26, 2020

I have an issue / a question (pick one) about Vlc.DotNet.

Generic information

  • Vlc.DotNet version : 3.0.0
  • Vlc.DotNet project used : WinForms
  • libvlc version : 3.0.11 NuGet Package
  • .net version : 4.7.2
  • Project language : C#
  • Project build architecture : AnyCPU
  • Operating system : Windows 10 x64

Summary

I try to stream image to udp multicast :

var mediaOptions = new[]
                {
                ":fake-file D:\\img.png",
                ":sout=#transcode{vcodec=h264,acodec=none,vb=2000,width=1920,height=1080}",
                ":std{access=udp,mux=ts,dst=239.1.1.1:1234}",
                ":pid-video=299",
                ":loop",
                ":repeat"
            };
            player.SetMedia("fake:", mediaOptions);
            player.Play();

Result error, what is the good way ?

LOG:

[06962300] stream_out_transcode stream out error: cannot create chain

[069706b0] main stream output error: stream chain failed for `transcode{vcodec=h264,acodec=none,vb=2000,width=1920,height=1080}'

[0696c7a8] main input error: cannot start stream output instance, aborting

Thanks,

@mfkl
Copy link
Contributor

mfkl commented Jun 26, 2020

":fake-file D:\\img.png",
player.SetMedia("fake:", mediaOptions);

This looks weird.

Please share full logs.

@jeremyVignelles
Copy link
Collaborator

We can't help you until you manage to make that work in VLC itself.
Once this is done, you wille probably already have the command line options to pass, and won't need our help anyway.

@Yaya859
Copy link
Author

Yaya859 commented Jun 26, 2020

In CLI it works :

start vlc fake: :fake-file D:\img.png :sout=#transcode{vcodec=h264,acodec=none,vb=2000,width=1920,height=1080}:std{access=udp,mux=ts,dst=239.1.1.1:1234} :pid-video=299 :loop :repeat

I try to do same with Vlc.DotNet.

@jeremyVignelles
Copy link
Collaborator

Try to replace
":fake-file D:\\img.png",
with
":fake-file", "D:\\img.png",

@Yaya859
Copy link
Author

Yaya859 commented Jun 26, 2020

Same error :

var mediaOptions = new[]
                {
                ":fake-file",
                "D:\\img.png",
                ":sout=#transcode{vcodec=h264,acodec=none,vb=2000,width=1920,height=1080}",
                ":std{access=udp,mux=ts,dst=239.1.1.1:1234}",
                ":pid-video=299",
                ":loop",
                ":repeat"
            };

            player.SetMedia("fake:", mediaOptions);

@jeremyVignelles
Copy link
Collaborator

try with:

var mediaOptions = new[]
                {
                ":fake-file",
                "D:\\img.png",
                ":sout=#transcode{vcodec=h264,acodec=none,vb=2000,width=1920,height=1080}:std{access=udp,mux=ts,dst=239.1.1.1:1234}",
                ":pid-video=299",
                ":loop",
                ":repeat"
            };

            player.SetMedia("fake:", mediaOptions);

:std is not a separate parameter but the configuration of the sout chain.

@Yaya859
Copy link
Author

Yaya859 commented Jun 26, 2020

Thanks, now its working while 2-3 seconds. Why the loop/repeat not working ?

FileInfo file = new FileInfo("D:\\img.png");

            var mediaOptions = new[]
                {
                ":fake-file",
                "D:\\img.png",
                ":sout=#transcode{vcodec=h264,acodec=none,vb=2000,width=1920,height=1080}:std{access=udp,mux=ts,dst=239.1.1.1:1234}",
                ":pid-video=299",
                ":loop",
                ":repeat",
                ":input-repeat=-1"
            };

            player.SetMedia(file, mediaOptions);
            player.Play();

@jeremyVignelles
Copy link
Collaborator

not sure it is supported with libvlc. does that work in vlc itself?

You could also handle the EndReached event ant loop yourself (don't forget to switch threads)

@Yaya859
Copy link
Author

Yaya859 commented Jun 26, 2020

Yes it works with VLC by CLI.

Edit : Mistake, loop not working with CLI.
The stream is playing only 10 seconds, with event EndReached I force loop thanks.
Why 10 seconds ? I don't found how increase to 60 seconds.

@Yaya859
Copy link
Author

Yaya859 commented Jun 26, 2020

I found this : Default duration of 10s when fake isn't forced. Make it possible to use fake:///path/to/image as well

I use :fake-duration=60000 but always 10 seconds :

FileInfo file = new FileInfo("D:\\img.png");

            var mediaOptions = new[]
                {
                ":fake-file",
                ":sout=#transcode{vcodec=h264,acodec=none,vb=2000,width=1920,height=1080}:std{access=udp,mux=ts,dst=239.1.1.1:1234}",
                ":fake-duration=60000"
            };

            mediaPlayer1.SetMedia(file, mediaOptions);
            mediaPlayer1.Play();

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@jeremyVignelles @mfkl @Yaya859 and others