Monday 15 November 2010

Working day

A day at work:
  • I arrive around 8AM... Today, I only need to read and comment two papers, prepare a lesson, and give it
  • 8:10: I need to read the two papers... Ok, let's print them. Unfortunately, the printer is out of paper.
  • 8:11: search for some paper...
  • 8:40: after a long quest, found some paper
  • 8:45: the papers are printed. Start to read them
  • 9:05: "you got mail"... Some problems with a web server not working. But the admins say it's working, and all the issues are just imagination. I need to reproduce the issues to give the admins some evidence.
  • 9:50: looks like the web server admins are already aware of the issues... But they keep saying that using a web server for distributing something via http is an improper usage of the server, and so the server might fail. For example, the objects to be distributed are in the "public_html" directory, and the user can delete them... So, the server is supposed to fail. Ok, I need some coffee to understand what the hell they are talking about.
  • 10:00: got some coffee, restart to read the sysadmins emails
  • 10:30: I need another coffee. Now the problem seems to be related to the network unreliability.
  • 10:40: Ok, got it: everything is supposed to fail, by design. I can restart reading my papers
  • 10:50: department report. Everyone is supposed to have 5 papers mentioned in the report; I do not care, so I did not recommend any paper for inclusion. But now they somehow have a list of 10 of my papers, candidate for inclusion. And I can have only 5 papers in the report... So, someone comes to my office asking for an advice. I do not even know where this list of 10 paper is coming from, so I do not know what to say...
  • 11:00: after wasting some time discussing about these 10 papers which should be 5 but I do not care so they can be 0 but they have a list of 10, I realise that it will take some time... So, let's discuss. Maybe I can even have some fun with this stuff... So, my co-worker in the next office also has some papers; let's ask his opinion too...
  • 11:05: the cell phone rings. Small problems at home, nothing really serious
  • 11:10: I leave to other people the discussion about the department report and the 5 papers to be cited... wasted 20 minutes, but had some fun
  • 11:15: try to return to the famous 2 papers... But new emails are coming.
  • 11:20: need to discuss via email some trivial details about software design
  • 11:55: the discussion resulted to be longer than expected... Not finished yet, but now I need another coffee
  • 12:05: lunch
  • 12:35: return to the discussion (erm... Delirium) about software design. Other wasted time
  • 12:50: really need to prepare the lesson
  • 13:50: go to the lesson
  • 16:00: end of the lesson
  • 16:05: now, I have to go and talk with the people experiencing the (in)famous web server problem. Need to explain that the problem is just imagination. Or to find a testcase that can be reliably reproduced.
  • 16:30: I give up. Time to go home
  • 17:20: At home. Still thinking about web services, department reports, software design... I would need another coffee, but that wouldn't be too healthy. Go for jogging instead.
  • 18:10: Back from jogging
  • 18:25: After a shower, more relaxed... Now, I'd like to do something useful... Maybe some research... I still have those 2 papers to read.
  • 19:30: Dinner
  • 20:00: I finally finish to read the two damned papers!

Thursday 4 November 2010

What happened?

So, I've been silent since about April...
If anyone is reading this blog, they might wonder what happened... It happened that I am a happy man, now (well, I was happy in the past, too... But now I am happier).
This consumed almost all of my summer (and some of my autumn... :), but I really think it was worth it!

Monday 26 April 2010

RTP streaming with ffmpeg

Since I often receive private emails asking details about RTP streaming with ffmpeg, I decided to write down some notes about it.
So, first of all, yes, ffmpeg can stream audio and video over RTP. And, as far as I know, there are no major issues with this feature... You just need to know how to do it.

Let's see... The simplest command line you can use to generate an RTP session composed by an audio stream and a video stream is:

ffmpeg -re -i input.mpg -vcodec copy -an -f rtp rtp://224.10.20.30:20000 -vn -acodec copy -f rtp rtp://224.10.20.30:30000 -newaudio
Analysing this command line:
  • "-re" is needed to stream the audio and the video at the correct rate (instead of streaming as fast as possible)
  • "input.mpg" is the input file, to be streamed
  • this example just streams the audio and the video tracks without re-encoding them... Hence, "-vcodec copy" and "-acodec copy"
  • we need one output for the video, and one for the audio. Hence, the first output has "-an" (no audio), the second output has "-vn" (no video), and there is a "-newaudio" at the end (add the audio track to the second output)
  • the output format has to be RTP. Hence, "-f rtp"
  • the output protocol, has to be RPT, hence, the output file names are "rtp://:"

If you want to re-encode the audio or the video, you can change "-vcodec copy" and "-acodec copy" with whatever you prefer (for example, "-vcodec mpeg4", or similar).

After you start the ffmpeg program, it will print something like

[...]
Stream #0.1 -> #1.0
SDP:
v=0
o=- 0 0 IN IP4 127.0.0.1
s=No Name
t=0 0
a=tool:libavformat 52.61.0
m=video 20000 RTP/AVP 32
c=IN IP4 224.10.20.30
b=AS:104857
m=audio 30000 RTP/AVP 14
c=IN IP4 224.10.20.30
b=AS:64
[...]


You need to copy the SDP description (starting with "v=0") in a .sdp file, that you will use to play the stream with vlc, ffplay, mplayer, or your favorite video player.

That's it!!!

More details will probably come in the future...