You are here: Home » Topic » 20051117 and transcoding…

20051117 and transcoding…

This topic contains 5 replies, has 2 voices, and was last updated by  rpedde 11 years, 10 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #136

    CCRDude
    Participant

    Ok, it’s the same bug I have since 20051112 😉 But now I have the proper log lines from the log… cut of the long http request header and starting with the select:

    2005-11-18 13:43:59: Executing: SELECT * FROM songs WHERE id=3854
    2005-11-18 13:43:59: Thread 34: Autoconvert file /dummy path/important (breaks)/Acidland.flac for client
    2005-11-18 13:43:59: Executing /etc/mt-daapd-ssc.sh “/dummy path/important (breaks)/Acidland.flac” 0 247.910
    2005-11-18 13:43:59: Updating Content-Type from application/x-dmap-tagged to audio/wav
    2005-11-18 13:43:59: Added *Connection=Close*
    2005-11-18 13:43:59: Emitting reponse header Connection: Close
    2005-11-18 13:43:59: Emitting reponse header Expires: -1
    2005-11-18 13:43:59: Emitting reponse header Cache-Control: no-cache
    2005-11-18 13:43:59: Emitting reponse header Content-Type: audio/wav
    2005-11-18 13:43:59: Emitting reponse header DAAP-Server: mt-daapd/cvs-20051117
    2005-11-18 13:43:59: Emitting reponse header Accept-Ranges: bytes
    2005-11-18 13:43:59: Emitting reponse header Date: Fri, 18 Nov 2005 12:43:59 GMT
    2005-11-18 13:43:59: Entering config_set_status
    2005-11-18 13:43:59: Exiting config_set_status
    2005-11-18 13:43:59: Session 0: Streaming file ‘Acidland.flac’ to 192.168.13.12 (offset 0)
    2005-11-18 13:43:59: Finished streaming converted file to remote
    2005-11-18 13:43:59: Got CLD signal. Reaping
    2005-11-18 13:43:59: Entering config_set_status
    2005-11-18 13:43:59: Exiting config_set_status
    2005-11-18 13:43:59: Thread 34: Terminating
    2005-11-18 13:43:59: Thread 34: Freeing request headers
    2005-11-18 13:43:59: Thread 34: Freeing response headers
    2005-11-18 13:43:59: Thread 34: Freeing request vars
    2005-11-18 13:43:59: Thread 34: Closing fd
    2005-11-18 13:43:59: With thread 34 exiting, 1 are still running

    So the transcoding script is actually started, but I get a:

    Acidland.flac: ERROR initializing decoder
    state = 2:FLAC__FILE_DECODER_ERROR_OPENING_FILE
    wavstreamer: Can’t read wav header.

    If I do the same with switching to the real path and then running mt-daapd-ssc.sh from there (with only filename and no path passed), everything works. Now let’s take a look at the path (obviously just an example:

    /etc/mt-daapd-ssc.sh “/dummy path/important (breaks)/Acidland.flac”

    BUT! With quotes around the filename, you must not escape the brackets. Voila – everything works (at least from command line, I bet it would do from mt-daapd as well 😉 ).

    edit: I did edit ssc.c, and by commenting out lines 107 and 108, streaming is working now :laugh:

    Post edited by: CCRDude, at: 2005/11/18 12:25

    #3839

    CCRDude
    Participant

    Ok, here’s another partly solution for people with Musepack problems. Some older nightly (maybe badly configured by myself) did add the musepack songs with an empty codectype field. This resulted in empty tags (length of files is displayed as “continously”, title is filename) that weren’t updated even with a valid compile later on. To fix those, do a:

    /etc/init.d/mt-daapd stop
    sqlite /var/cache/mt-daapd/songs.db
    delete from songs where fname like ‘%.mpc’;
    .exit
    /etc/init.d/mt-daapd start

    Running mt-daapd with -d9 now tells me:
    2005-11-18 15:18:20: Executing: SELECT * FROM songs WHERE id=12476
    2005-11-18 15:18:20: Thread 1: Length of file (remaining) is 8285245
    2005-11-18 15:18:20: Updating Content-Type from application/x-dmap-tagged to audio/mpc
    2005-11-18 15:18:20: Added *Content-Length=8285245*
    2005-11-18 15:18:20: Added *Connection=Close*
    2005-11-18 15:18:20: Emitting reponse header Connection: Close
    2005-11-18 15:18:20: Emitting reponse header Content-Length: 8285245
    2005-11-18 15:18:20: Emitting reponse header Expires: -1
    2005-11-18 15:18:20: Emitting reponse header Cache-Control: no-cache
    2005-11-18 15:18:20: Emitting reponse header Content-Type: audio/mpc
    2005-11-18 15:18:20: Emitting reponse header DAAP-Server: mt-daapd/cvs-20051117
    2005-11-18 15:18:20: Emitting reponse header Accept-Ranges: bytes
    2005-11-18 15:18:20: Emitting reponse header Date: Fri, 18 Nov 2005 14:18:20 GMT
    2005-11-18 15:18:20: Entering config_set_status
    2005-11-18 15:18:20: Exiting config_set_status
    2005-11-18 15:18:20: Session 0: Streaming file ‘Przedtem.mpc’ to 192.168.13.12 (offset 0)
    2005-11-18 15:18:20: Finished streaming file to remote: 208896 bytes
    2005-11-18 15:18:20: Entering config_set_status
    2005-11-18 15:18:20: Exiting config_set_status
    2005-11-18 15:18:20: Thread 1: Terminating
    2005-11-18 15:18:20: Thread 1: Freeing request headers
    2005-11-18 15:18:20: Thread 1: Freeing response headers
    2005-11-18 15:18:20: Thread 1: Freeing request vars
    2005-11-18 15:18:20: Thread 1: Closing fd
    2

    I thought I maybe had to add it to ssc_codectypes (even though those are handled by the ssc_prog, which seems to not be fit to handle mpc and as I understand mpc handling was from the inside), but that’s not much different.

    2005-11-18 15:19:35: Session 0: Streaming file ‘Zgon.mpc’ to 192.168.13.12 (offset 0)
    2005-11-18 15:19:35: Finished streaming converted file to remote
    2005-11-18 15:19:35: Got CLD signal. Reaping

    Could someone enlighten me on what I have to do to get Musepack playback to work? Add it to ssc_codectypes or not? Everything compiles fine with –enable-musepack, which would not do if taglib wasn’t installed. If it’s all integrated, I would guess that if some component needed was not found, I would have been told during configure or make?

    #3840

    rpedde
    Participant

    the –enable-musepack just parses the metadata for musepack files.

    To transcode it, you’ll have to add “mpc” to your ssc_codectypes and then fix the transcoding script to convert mpc to wav.

    Truthfully, I don’t know what a mpc file is, what the mpc-to-wav command is, or anything.

    I guess I could probably make some musepack files and fix up the transcoding script, huh?

    #3841

    CCRDude
    Participant

    Oh. When I had an old taglib version installed, configuring with –enable-musepack through some error messages, and I saw something about wavstreamer… then I saw a wavstreamer.c file in the source… and since the transcoding script uses wavstreamer as well, I somehow related this to the idea that in the case of musepack, the transcoding would be made through mt-daapd itself :laugh:

    Now that this is clear, Musepack isn’t a problem any more… I guess for decoding mpc, mppdec would fit. All the script needs is a :

    mpc_file() {
    $MPPDEC –wav –prev –gain 2 “$FILE” – | $WAVSTREAMER -o $OFFSET $FORGELEN
    }

    (and the proper definition of $MPPDEC and the if clause to call this mini-function…)

    And it’s working quite well (all ogg, flac and mpc now), thank you 🙂

    PS: regarding the escaping from my first post: I’m not sure if removing those two lines will have any negative side effects… do you need escaping there for any other stuff maybe?

    #3842

    rpedde
    Participant

    At least need an escape for quote… I really need to RTFM and see what has to be escaped in quotes.

    popen doesn’t sanitize anything, so a filename with a quote in it could be exploited to execute an arbitrary executable as the “runas” user. I just need to see what else has to be escaped.

    — Ron

    p.s. there are a couple reasons for wavstreamer — one is that it reads and writes in large blocks, which helps performance a lot. The other is that a lot of programs don’t write proper wav headers when they stream to stdout — they don’t know the length of the file before they decode it, so they send wav headers with zero length. iTunes doesn’t like that, so wavestreamer dummies up the wav headers with the appropriate song length based on what was scanned from the tags.

    That’s what wavstreamer is about.

    #3843

    rpedde
    Participant

    Just as a followup, these are the metachars that need escaping:

    “, $, `, and

    Not ( ), which I had in there.

    Oops. Fixed in CVS.

    — Ron

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.