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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
03-25-2010, 05:11 PM
|
#1
|
|
Member
Registered: Aug 2003
Location: United States
Distribution: Ubuntu 9.10, Red Hat
Posts: 49
Rep:
|
Installing & Configuring FFmpeg & Segmenter
Environment: CentOS 5.4 with cPanel, Apache 2.x, PHP, MySQL
I am trying to figure out the best way to configure our server so that we can use Apple's HTTP Live Streaming protocol ( more info here) in order to "stream" MP3 audio from our website to iPhone clients.
We are thinking about putting it on a different port than the normal apache port because we only want the audio to stream with segmentation when the client is an iPhone. Otherwise, we want the user to be able to download the file.
I've been researching this most of the day, and haven't gotten into the gritty work. This blog seems to be the best source of information, since this is still such a new concept.
According to this blog, I need ffmpeg to encode files. But I don't think I need to encode anything, because I'm not streaming live, and the files that are sitting on the server are already in MP3 format.
What do you think would be the best way to go about solving our issue? I decided to give FFmpeg a try, because ffmpeg can apparently be used to stream and segment files as well. I installed it using Yum. But I'm not quite sure what to do from here.
If I need an additional segmentation program (perhaps I do), this is the only one I've been able to find: http://svn.assembla.com/svn/legend/segmenter/
I downloaded the source code, and created the make file. When I run "make" my log output indicates a ton of errors - what do I need to do in order to get it to work? The log is attached.
Thanks for any help,
David
|
|
|
|
03-26-2010, 11:03 AM
|
#2
|
|
Senior Member
Registered: Jun 2008
Location: Eelam
Distribution: Redhat, Solaris, Suse
Posts: 1,093
Rep:
|
Did you check whether the segmenter compatible with Linux?, as i understand it has developed for MacOS
|
|
|
|
03-26-2010, 03:20 PM
|
#3
|
|
Member
Registered: Aug 2003
Location: United States
Distribution: Ubuntu 9.10, Red Hat
Posts: 49
Original Poster
Rep:
|
I honestly have no idea. I posted to the blog for additional support ( http://www.ioncannon.net/programming...rce-segmenter/), although I think it's unlikely someone will respond (posted by "David" where David's post links to this forum post, and the name "David" links to my blog).
I'm wondering if someone could recommend another segmenter. From what I can tell, this is still such a new concept that hardly anything exists. But perhaps I'm wrong and there are other streaming / segmenter programs that I should consider. After talking on IRC in multiple channels, and reading countless blogs and tutorials for the last 2 days, I don't think so.
- David
|
|
|
|
03-26-2010, 09:32 PM
|
#4
|
|
Senior Member
Registered: Jun 2008
Location: Eelam
Distribution: Redhat, Solaris, Suse
Posts: 1,093
Rep:
|
|
|
|
|
03-29-2010, 04:12 PM
|
#5
|
|
Member
Registered: Aug 2003
Location: United States
Distribution: Ubuntu 9.10, Red Hat
Posts: 49
Original Poster
Rep:
|
Thanks for the response and for that link. It was helpful.
I've spent the day doing more research and work on this project, and have been able to get live_segmenter.c compiled, as provided by the link above ( http://blog.kyri0s.org/post/27112194...in-a-gnu-linux). However, it appears that there is a wrapper Ruby script that uses this segmenter. I'd really like to figure out I can use the segmenter by itself.
Since I don't know C or Ruby, that's been tough to do. I've picked out a few things from the C code though, and by running ./live_segmenter, I can tell what it's asking... I just am unclear on what is an appropriate input for the segmenter.
I'm making progress though. I can't say that I've spent 24 hours (3 work days) on a project before... and this will definitely go into tomorrow and possibly later this week if I continue to have trouble finding documentation / figure out how this segmenter works.
But, thanks again for the link. I appreciate it.
For some reason my comment to the blog that I linked to in my earlier forum post either didn't make it onto the blog, or was deleted. Not sure what that's about.
Edit:
I have determined that live_segmenter.c is a script that in and of itself, will not work. It must have a wrapper script. In the case of the original author, he chose to use Ruby - which I don't want to use. As a result, I have decided to go through the Ruby code and its comments, and to try to port the code into a shell script, which I will then call with PHP. If I'm successful, I'll be sure to post here as well as to my blog. In the mean time, if this has already been done, I'm certainly not aware of it. If you ARE aware, please let me know!
- David
Last edited by Rudy; 03-29-2010 at 05:08 PM.
|
|
|
|
05-03-2010, 11:00 PM
|
#6
|
|
LQ Newbie
Registered: May 2010
Posts: 4
Rep:
|
Any progress?
Hey Rudy,
Would love to know if you've made any progress with this. I've been stuck at the same point I think you were at in your last post... I get this message when I input pretty much anything:
Usage: ./live_segmenter <segment length> <output location> <filename prefix> <encoding profile>
I can't figure out if it's a matter of me entering input in the wrong format (tried everything), incompatible versions of ffmpeg/segmenter, maybe segmenter can't run alone, or perhaps not making an adequate sacrifice to the segmenter gods...
Any help or advise would be greatly appreciated as I am at a total loss...
Btw, using centOS 5.4 as well...
|
|
|
|
05-03-2010, 11:32 PM
|
#7
|
|
Member
Registered: Feb 2003
Posts: 968
Rep:
|
what are you needing segmenter for ? Or ffmpeg for that matter? arecord + sox + lame + ??? audio is relatively easy. Depending on continuous audio recording versus delivery time(s). And/or how many second(s) of interruption are acceptable.
|
|
|
|
05-04-2010, 09:54 AM
|
#8
|
|
LQ Newbie
Registered: May 2010
Posts: 4
Rep:
|
Hello Shadow...
Quote:
Originally Posted by Shadow_7
what are you needing segmenter for ? Or ffmpeg for that matter? arecord + sox + lame + ??? audio is relatively easy. Depending on continuous audio recording versus delivery time(s). And/or how many second(s) of interruption are acceptable.
|
Hello Shadow, thanks for asking... I'm trying to capture a video, encode it on-the-fly, and then stream it pseudo-live... 30 sec delay or more is no big deal. I suppose that might be called re-streaming? I'm using the latest version of ffmpeg and the version of carson mcdonald's segmenter from blog.kyriOs.org.
I think Carson was using Fedora, and the blog above was using Debian... so I'm wondering if my problems have anything to do with being on centOS 5.4? Though I suspect it's something else...
Also, the segmenter asks for .ts input. So I've tried to feed it an already encoded .ts file to eliminate the possibility of an ffmpeg/segmenter version incompatibility, but I just get the same message.
Last edited by darkproton; 05-04-2010 at 09:58 AM.
Reason: forgot
|
|
|
|
05-04-2010, 10:25 AM
|
#9
|
|
Member
Registered: Feb 2003
Posts: 968
Rep:
|
video is not so easy.
are you using the latest ffmpeg?
ffmpeg.mplayerhq.hu
.ts is an odd one. Something along the lines of mpeg2 transport stream -f mpegts, but the actual video might be x264 and not mpeg2video. So get libx264 from videolan.org and be sure to --enable-shared as it's not the default.
Your build.log shows errors right off the bat. Which is never good. Did you ./configure the source before make? Or however that package is setup. scons mercurial m4 imake and tons of build variations over the years. Or it could be old school and something like make -f Makefile. stddef.h seems to be in lots of places, kernel headers and/or libc-dev. If you're going to build anything from source, those are pretty much mandatory. You might also need to override the path from the default /usr/local/ to just /usr/ with something like ./configure --prefix=/usr
Media editing pretty much requires the latest and greatest across the board. Some of which has odd licensing and is only available in source form.
Last edited by Shadow_7; 05-04-2010 at 10:26 AM.
|
|
|
|
05-04-2010, 04:40 PM
|
#10
|
|
LQ Newbie
Registered: May 2010
Posts: 4
Rep:
|
Thanks again Shadow... I definitely appreciate the input.
Yes, I have the latest ffmpeg. I've also made sure to use the most up to date libs and have x264 installed. I double checked all my header links and shared library links. The strange thing is I'm pretty sure I installed ffmpeg and the segmenter properly (and very carefully), but I can only get the following message when I input commands into the segmenter:
"Usage: live_segmenter <segment length> <output location> <filename prefix> <encoding profile>"
I'm sure I must have missed something, but just can't see it...
Any suggestions? Has anyone experienced (and hopefully overcome) the same problem?
|
|
|
|
05-05-2010, 12:32 PM
|
#11
|
|
Member
Registered: Feb 2003
Posts: 968
Rep:
|
what's the live_segmenter command you are trying that's generating that error?
Usage: %s <input MPEG-TS file> <segment duration in seconds> <output MPEG-TS file prefix> <output m3u8 index file> <http prefix> [<segment window size>]
From the segmenter.c previously linked to. %s will likely be the application name. file prefix will likely be without the .ext stuff. Maybe even %03d or something for number of digits to use on the numbering scheme. But I'd have to check the source to be sure. http prefix might be with or without a trailing /. duration in seconds might be just ##'s or in a format HH:MM:SS, again the source should tell all. Fortunately it's only 402 lines.
download the makefile and edit the Makefile so that the /usr/local/ path is /usr/ instead of /usr/local/, if that's your thing, then:
$ make -f Makefile
# make -f Makefile install
or do it the long way.
$ gcc -Wall -g segmenter.c -o segmenter -lavformat -lavcodec -lavutil
# cp segmenter /usr/bin/
or just run it where it compiled.
/full/path/to/./segmenter
I got a warning when compiling.
Code:
gcc -Wall -g segmenter.c -o segmenter -lavformat -lavcodec -lavutil
segmenter.c: In function ‘main’:
segmenter.c:242: warning: ‘guess_format’ is deprecated (declared at /usr/include/libavformat/avformat.h:786)
which means nothing really as the segmenter binary exists. Lots of means to an end. There's also ffserver and other options for the same or similar task.
|
|
|
|
05-05-2010, 03:28 PM
|
#12
|
|
LQ Newbie
Registered: May 2010
Posts: 4
Rep:
|
Quote:
Originally Posted by Shadow_7
what's the live_segmenter command you are trying that's generating that error?
|
Well, I've tried a lot of different commands and they all give that same result. Carson's format is:
segmenter <input MPEG-TS file> <segment duration in seconds> <output MPEG-TS file prefix> <output m3u8 index file> <http prefix>
so for him, this meant:
segmenter sample_low.ts 10 sample_low stream_low.m3u8 http://www.ioncannon.net/
I've tried it both in this format as well as with a path leading to my file. I started out with:
live_segmenter muted.ts 10 muted muted.m3u8 http://www.xxx.xx....
but my current permutation is:
live_segmenter /home/darkproton1/muted.ts 10 home/darkproton1/muted home/darkproton1/muted.m3u8 http://www.xxx......
and I've tried it with lots of variations in between... path specific names... non-path specific... so frustrating!
Quote:
|
...again the source should tell all. Fortunately it's only 402 lines.
|
You are THE MAN for even spending any time on this at all. Thank you regardless if I get this to work or not!
Quote:
download the makefile and edit the Makefile so that the /usr/local/ path is /usr/ instead of /usr/local/, if that's your thing, then:
$ make -f Makefile
# make -f Makefile install
or do it the long way.
$ gcc -Wall -g segmenter.c -o segmenter -lavformat -lavcodec -lavutil
# cp segmenter /usr/bin/
|
I've tried this a number of ways as well. My current permutation is the long way. I've also specified all paths to shared libraries and headers just to rule out all possibilities. So currently this looks like:
gcc -Wall -g live_segmenter.c -o live_segmenter -L/usr/local/lib -lavformat -lavcodec -lavutil -lmp3lame -L/usr/lib/ -lm -lbz2 -lpthread -lz -L/usr/local/src/x264/x264 -I/usr/include/stdio -I/usr/include/string -I/usr/include/unistd -I/usr/local/include/libavformat/avformat
ugly, I know. It didn't start out that way. I currently have segmenter installed in /usr/local/src/segmenter, but I will try it under usr/segmenter if you think that might help.
Quote:
I got a warning when compiling.
Code:
gcc -Wall -g segmenter.c -o segmenter -lavformat -lavcodec -lavutil
segmenter.c: In function ‘main’:
segmenter.c:242: warning: ‘guess_format’ is deprecated (declared at /usr/include/libavformat/avformat.h:786)
|
I had this error initially. I found the fix at blog.kyri0s. It involved changing the 'guess_format' line in segmenter.c to 'av_guess_format' (it comes about 15 lines after "----done parsing input---")
Quote:
|
Lots of means to an end. There's also ffserver and other options for the same or similar task.
|
I was hoping to use segmenter as a means towards http "live" streaming, and I haven't given up on it yet, but I will definitely look into those other options. Thanks so much.
|
|
|
|
05-05-2010, 05:08 PM
|
#13
|
|
Member
Registered: Feb 2003
Posts: 968
Rep:
|
I'm eventually going to do some streaming stuff which is why i'm looking at it myself. And I've spent a number of efforts on A/V conversions over the past year. Finally figuring out a decent format to upload to youtube that it doesn't mess up (much). Technically I only needed to change .mp4 to .mkv as the output name for the conversion script.
Anyway, it might be that 10 seconds is too short an interval. 30 seconds would be safer IMO. Although really you should be doing chunks in minutes IMO. 10 seconds might not be enough time to resolve the fully qualified URL. File type .ts might also work as .mts or .m2ts, just some stuff to try. That format has been a bit squirrelly for HD camcorders up until recently (< 2 years).
RTMP? (or was it RTSP?) seems to be the trend, versus the old .pls / .mls / .m3u8 type ways. I'm really not that up on it although I'd like to be eventually.
Since the executable is all that you're after, it really doesn't matter where you install it. As long as you run the version you want to run. Safer to use the exact and full path if you have multiple versions out there. Changing line 242 from guess_format to av_guess_format compiled clean. It does look like that might be a little more than warning material. Although perhaps still supported in the current versions. Lots of API changes to lots of stuff lately. It can really break stuff that's not actively maintained. You might check to see if the avformat.h you're pulling in matches your version of ffmpeg.
$ cmp /usr/include/ffmpeg/avformat.h /home/darkproton1/ffmpeg/include/avformat.h
or where ever your sources are located. I tend to install everything to /usr/. That's just a prefix i.e. --prefix=/usr. source stuff goes to /usr/include/. executable stuff to /usr/bin/. libs to /usr/lib/. Where the default from sources is typically a /usr/local/. But that can be tricky if there's /usr/ distro versions and your $PATH doesn't include /usr/local/ and/or includes /usr/ before /usr/local/. It can be a real mess if you maintain stuff in BOTH locations. Less so if you actually use your distro management system, but that's no light learning curve in and of itself.
I can't verify mine at the moment since it's tar'd up ready for a new HDD for my laptop. Which is quite hard to find by the looks of things. Odd since I got the current drive by accident when getting a desktop HDD. Not that changing the name of IDE to ATA to PATA to ??? helps much. Which I guess happened sometime between 2006 and 2009. I apparently need a 2.5" PATA notebook drive. Grabbed a sata drive by mistake. Grabbed a pata desktop drive by mistake the second time. Tried to verify my choice online before screwing up a 3rd time and it looks like my options are 2.75" drives. Perhaps time for a new laptop. As I consider making this one the new router.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 09:39 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|