LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-27-2015, 08:15 PM   #1
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Costa Rica
Distribution: Kubuntu, Debian, Knoppix
Posts: 2,092
Blog Entries: 1

Rep: Reputation: 90
how to easily create a stream that could be seen on a terminal?


As a network experiment, I'd like to be able to stream some content to people that connected to a certain port of my computer, as if it were aa or caca output.

I know it's possible to use mplayer to be able to see video on the terminal of the local computer and so I thought that it shouldn't be too difficult to try to stream it into the network.

How can that be easily achieved?

Thanks in advance.
 
Old 05-27-2015, 10:19 PM   #2
Sefyir
Member
 
Registered: Mar 2015
Distribution: Linux Mint
Posts: 634

Rep: Reputation: 316Reputation: 316Reputation: 316Reputation: 316
Try using netcat (nc)?

On server side (sending out the stream)
Code:
nc -l portnumber
on client side (recieving stream)
Code:
nc ip-addr portnumber
with mplayer

Code:
nc ip-addr portnumber | mplayer -
This will only work on a 1:1 basis rather then 1:multi.
You'll need something like icecast for that which is more "suited" but increases in complexity.

Last edited by Sefyir; 05-27-2015 at 10:20 PM.
 
Old 05-27-2015, 10:32 PM   #3
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Costa Rica
Distribution: Kubuntu, Debian, Knoppix
Posts: 2,092

Original Poster
Blog Entries: 1

Rep: Reputation: 90
I thought of netcat but I would have to feed it the multimedia stream.... and my question was pointed more or less in that direction. Say, something along the lines of:

Code:
multimedia-encoder --whatever-options-to-produce-the-stream-content sourcefile.avi | nc -l 4567
And then someone be able to see the content by doing this:

Code:
telnet ip-address 4567
But then it would only work for the first client that connects, right? How about producing content for anyone that connects?
 
Old 05-27-2015, 11:28 PM   #4
Sefyir
Member
 
Registered: Mar 2015
Distribution: Linux Mint
Posts: 634

Rep: Reputation: 316Reputation: 316Reputation: 316Reputation: 316
Quote:
But then it would only work for the first client that connects, right? How about producing content for anyone that connects?
Then it'd have to create a new connection for that user.

Use something designed for broadcasting media to multiple users

http://mpd.wikia.com/wiki/Icecast2


This example would not work
Code:
multimedia-encoder --whatever-options-to-produce-the-stream-content sourcefile.avi | nc -l 4567
You can't both save and pipe the file. Since it is being saved as sourcefile.avi, nothing is sent to stdout and nc has nothing to send to a user.
IF you want to both save a file and send it out, tee does this.
Code:
multimedia-encoder --whatever-options-to-produce-the-stream-content - | tee sourcefile.avi | nc -l 4567
This would cause the output to be saved as sourcefile.avi and piped to nc.
This can have unexpected consequences if the multimedia-encoder depends on the file extension to determine how to encode it (like ffmpeg/avconv) which can be overridden by manually defining the format.
 
Old 05-27-2015, 11:31 PM   #5
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Costa Rica
Distribution: Kubuntu, Debian, Knoppix
Posts: 2,092

Original Poster
Blog Entries: 1

Rep: Reputation: 90
I understand what you mean.... but actually, in my example, sourcefile.avi is what you would like to stream out.
 
Old 05-27-2015, 11:48 PM   #6
Sefyir
Member
 
Registered: Mar 2015
Distribution: Linux Mint
Posts: 634

Rep: Reputation: 316Reputation: 316Reputation: 316Reputation: 316
I suggest experimenting. A common method of outputting a file into a program is with cat.
Code:
cat file | program
You can try it with just cat file too and see what happens.
(Ctrl + c will cancel any output the cat command does)

Last edited by Sefyir; 05-27-2015 at 11:49 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: How to easily create your own Google Chrome theme LXer Syndicated Linux News 0 04-16-2012 12:50 PM
how to create daily incremental backups easily? crypted Linux - Server 13 12-12-2010 03:41 AM
LXer: How to Easily Create Abstract Wallpaper In Gimp LXer Syndicated Linux News 0 05-12-2010 05:00 AM
How to easily create DVDs? General Linux - Software 1 06-15-2006 08:34 PM
Any idea how to easily create a new distro? BlackEcho Linux - General 4 11-10-2003 03:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:48 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration