LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 08-12-2022, 08:48 AM   #1
MirceaKitsune
Member
 
Registered: May 2009
Distribution: Manjaro
Posts: 155

Rep: Reputation: 1
ffmpeg can't assign requested address for http stream


I'm writing a script to stream webcam video / audio to http or rtmp using ffmpeg. I managed to get the capture devices right and have them output to mp4 file, streaming to UDP also seems to work but I want to go with TCP. For some reason ffmpeg always complains about the connection and is unable to access the address.

Code:
ffmpeg -f video4linux2 -i /dev/video0 -f alsa -i hw:2 -f mpegts http://1.2.3.4:5678
This instantly gives the error "connection refused". I understand I need to add the parameter "-listen 1" for http to work, I did so but now the error then becomes "cannot assign requested address". Some articles suggested using ffserver but that command doesn't exist, I take it the normal ffmpeg command acts as that now? Firewall settings and port forwarding in the router are configured and shouldn't be the problem.
 
Old 08-12-2022, 09:33 AM   #2
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
You are using ffmpeg to push the video stream. The destination must be already active and listening for that to work. It seems ffmpeg is unable to reach the destination so you get the error message.

Tcp requires a two-way connection to be established and remain active. Udp does not since it merely sends out the stream.

Last edited by computersavvy; 08-12-2022 at 09:35 AM.
 
Old 08-12-2022, 12:04 PM   #3
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,137
Blog Entries: 6

Rep: Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826
You can check what you are doing with:

In first terminal.
Code:
ncat -klp 8100 -v | mplayer -
In second terminal.
I don't have a web cam so I streamed a file
Code:
ffmpeg -i myfile.mp4 -c:a copy -c:v copy -f mpegts http://127.0.0.1:8100
 
Old 08-12-2022, 02:52 PM   #4
MirceaKitsune
Member
 
Registered: May 2009
Distribution: Manjaro
Posts: 155

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by computersavvy View Post
You are using ffmpeg to push the video stream. The destination must be already active and listening for that to work. It seems ffmpeg is unable to reach the destination so you get the error message.

Tcp requires a two-way connection to be established and remain active. Udp does not since it merely sends out the stream.
Thanks, seems I missed that part: I was used to the idea I just stream to an open port whenever ffmpeg is running, then any viewer can connect and disconnect freely at any time. There are http streams that work like that, you can access an URL anytime from your browser to view the stream.

That's kinda why I wanted TCP especially; Was hoping I could get the video playing from Firefox. FF doesn't support UDP though, I can only view it from VLC and similar which is okay too in the end.
 
  


Reply

Tags
ffmpeg



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
"ERROR: UDP_OpenSocket: bind: Cannot assign requested address" error trebor0926 Red Hat 1 09-26-2006 10:21 AM
ioctl[SIOCGIFADDR]: Cannot assign requested address mmcgann Linux - Wireless Networking 1 06-20-2006 12:09 PM
ifup eth0 causing error messages - SIOCGIFADDR: Cannot assign requested address pxumsgdxpcvjm Linux - Networking 7 01-20-2006 06:22 PM
Ssh tunnel : cannot assign requested address sieker Linux - Networking 6 11-11-2005 01:10 PM
sendmail quits - cannot bind: Cannot assign requested address scott_r_wagner Linux - Software 5 09-14-2003 05:40 PM

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

All times are GMT -5. The time now is 01:56 AM.

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