I have tryied to make some kind of transcoding, by creating a named pipe and trying to add it to mediatomb list of shared files. Im unable to do it, because mediatomb seems to reject sharing the file.
Mplayer plays the pipe quite well (of course without rewinding) ¿Do you think it is possible to make it work with mediatomb?
My script for creating the fifo (and recreating it when the other side process stops):
ffmpeg -y -i test.avi -target pal-vcd f1.mgp ;
Yes, thanks for pointing that out, I will make the necessary changes for the upcoming release.
Actually you could even use active items to trigger your script, allthough I think they may be broken in 0.8.1 :)
If you want I can tell you what you have to change in the code so that the current version accepts fifo's, it's not much.
Thanks for the idea, I already tried for last 60 days. VLC is quite buggy and inerrupts the stream for no or little reason. Quite unreliable. If we would have a file it would not be interrupted (unless it ended :-) ) . I also think VLC http server is not DSM-320 friendly. So, no go. If we would have a kind of buffer between VLC and DSM it would be better.
Yes, please, if you can tell me where to change the code it would be great, and I could test it before the release.
change if (S_ISREG(statbuf.st_mode)) // item
to if (S_ISREG(statbuf.st_mode) || (S_ISFIFO(statbuf.st_mode)) // item
change info->file_length = statbuf.st_size;
to if (S_ISFIFO(statbuf.st_mode)
info->file_length = -1;
info->file_length = statbuf.st_size;
When adding directories recursively the fifos will not be added, but you should be able to add
one directly via the UI. Tell me if it worked :) I hope I did not forget or screw up anything,
after all I did not test it (sorry have no time right now).
I can take a closer look in the evening if you encounter problems, but I think the changes above should do the trick.
Thanks Jin, It worked well! (after fixing some parenthesis). I added (with web interface) one directory with one fifo and one real mpg and both files were added ok (without having to select them individually, but I can only find them in "PC Directory" not in "Video" )
On my M740AV the files are played. There are some aspect ratio and audio synchronization issues, but I think (hope :) they are ffmpeg related.
I will post the transcoding scripts if I can fix it and see a decent movie
oh yeah, I messed that up (parenthesis) :)
they are not going to the video directory because of the mimetype, so you either have to add them via the UI and set everything manually, or you can use a more convinient way:
name your fifo files *.fifo, add an extension to mimetype mapping in the config.xml which will
point from .fifo -> video/mpeg (or whatever you are encoding to)
you could also go another way, if you have transcoded audio channels and transcoded video
channels you could chose different extensions and create appropriate mimetype mappings in config.xml
Then your fifo's would land in the Video / Audio directories. I hope the metadata parsers don't freak out when trying to gather id3 tags, etc. ;) Will be an interesting test :>
It would be a great idea to use the method above to stream and reencode live TV on fly. We could have a file created lets say by VLC or FFMPEG and just point UPNP client to the file. The difference would be that each new client will start watching the file not from the begining but lets say from 1 minute before it ends. I am sure it is possible to encode it into UPNP server so it would dynamically assign begining file position calcutating by formula: begining_position=end_position-100Kb (for example).
What do you think ?
Why would you want to save the data to a file? You mean something like recording and watching at the same time? If you use a FIFO like in the example above you will always get the "latest" data, no matter at what point in time you connect. I think the problem here is, that there can not be several readers on one FIFO at the same time (correct me if I am wrong :)
So we would probably need some sort of buffer between the FIFO and the reader.
But hey, I have another idea: why use a file/fifo at all? You can setup VLC to stream data on your LAN, you then create an External URL item in MediaTomb and point it to the HTTP stream that is reencoded by VLC.
Does that sound like a solution?
Well, as long as you only have one player you will probably by ok with a FIFO / ffmpeg / mencoder combination.
We do plan to add transcoding plugins/functionality to the server, we have not yet thought about the architecture - whether the server will use ffmpeg directly or if external scripts will do the job. But that is for the future, for now you could only rely on external programs...
Maybe some CGI script for apache, that will do the buffering?
can anybody please upload rpm for fc5 with pipe canges made. I am trying to rebuld and got error
libmediatomb.a(libmediatomb_a-action_request.o): In function `ActionRequest':
../src/action_request.cc:35: undefined reference to `ixmlPrintDocument'
I have built libupnp 1.4.1
Thanks for your help.
I guess something has changed in the library API. You could try downgrading libupnp to 1.3.x...
Right now our focus is on the upcoming release, hopefully it should not take long anymore. I do not think that we will update 0.8.x rpm's...
nothing changed in the library API regarding ixml.
Could you point me to a tarball with pipe changes made or a ptch against 0.8.1 so I can try to built against pupnp-1.4.1 ?
I didn't follow the pipe changes discussion :-(
I have compiled without problems with:
I'm using sources from mediatomb-0.8.1-1.fc5.src.rpm, with includes a mediatomb_0.8.1_fc5.patch (applied)
The pipe changes patch I made, using jin_eld instructions:
diff -Naur mediatomb-0.8.1/src/content_manager.cc mediatomb-0.8.1-pipe/src/content_manager.cc
--- mediatomb-0.8.1/src/content_manager.cc 2005-09-07 19:26:12.000000000 +0200
+++ mediatomb-0.8.1-pipe/src/content_manager.cc 2006-11-17 16:09:29.000000000 +0100
@@ -531,7 +531,8 @@
- if (S_ISREG(statbuf.st_mode)) // item
+ //if (S_ISREG(statbuf.st_mode)) // item
+ if (S_ISREG(statbuf.st_mode) || S_ISFIFO(statbuf.st_mode)) // item
/* retrieve information about item and decide
diff -Naur mediatomb-0.8.1/src/file_request_handler.cc mediatomb-0.8.1-pipe/src/file_request_handler.cc
--- mediatomb-0.8.1/src/file_request_handler.cc 2005-09-07 18:10:16.000000000 +0200
+++ mediatomb-0.8.1-pipe/src/file_request_handler.cc 2006-11-17 16:11:23.000000000 +0100
@@ -174,8 +174,15 @@
mimeType = item->getMimeType();
- info->file_length = statbuf.st_size;
+ //info->file_length = statbuf.st_size;
+ if (S_ISFIFO(statbuf.st_mode))
+ info->file_length = -1;
+ info->file_length = statbuf.st_size;
info->last_modified = statbuf.st_mtime;
info->is_directory = S_ISDIR(statbuf.st_mode);
Hmmm, so there is no issue with pupnp-1.4.1
Thank you for the detailed info provided.
there is no named-pipe tarball :) only 2 changes in the code had to be made, I simply posted them on the forum. None of those changes is related XML. So if this problem really exists, it should be reproducible with the regular 0.8.1 package.
apparently this is not about libupnp version, or the pipe changes made. It is probably a configuration, building issue.
thanks everyone for the analysis!
Thanks everyone for troubleshooting, I found and fixed problems with libupnp compiling. However after everything seems to be working mediatomb faced more problems. Looks like DSM-320 does not understand named pipes, to be more precise it does not know how long the file should be.
The line "info->file_length = -1;" condfuses DSM big time and it just freezes.
Any suggestions or ideas ?
In my Siemens gigaset M740-AV, pipes seem to work well, except for ratio aspect on some files, I have to make some more test.
Size is displayed as something like: 999999999, but the movie is played. Maybe instead of size = -1, size=something positive would do no harm.
-1 is not returned via HTTP - it just tells the UPnP SDK that the value is not known. The SDK then sends out appropriate HTTP headers, so this is perfectly fine. The clients then know that range requests are not possble - so you will not be able to do any FF/REW operatoins and so on.
The "99999.." displayed by the M740-AV is clearly a bug.. because HTTP does specifcy serving content with unknown lengths.
Ansher, regarding the DSM-320 - check, what upnp class was set for your named pipe item?
The DSM-320 will crash if the upnp:class is set incorrectly. That's why we have this stuff in the config.xml
<map from="audio/*" to="object.item.audioItem"/>
<map from="video/*" to="object.item.videoItem"/>
<map from="image/*" to="object.item.imageItem"/>
It is best if you add your named pipe via the UI and set mimetype and upnp:class manually. Was this the problem?
Thanks, I have added item manually thru web-interface. The Class is "object.item.videoItem" . The file is MPEG1 and shows as "video/mpeg"
Log in to post a comment.