Won’t transcode movie

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #1993
    Anonymous
    Inactive

    I’m trying to get iTunes to play my AVI files. Looking through the documentation, this forum and the comments in the config file, I concluded that this should be possible by transcoding the AVI…

    web_root = /usr/share/mt-daapd/admin-root
    port = 3689
    admin_pw =
    db_type = sqlite3
    db_parms = /var/cache/mt-daapd
    mp3_dir = /share/Music/,/share/Movies/,/share/TV_Series/
    servername = iTunes on %h
    runas = mt-daapd
    extensions = .mp3,.MP3,.ogg,.flac,.mov,.m4v,.avi,.wav,.mp4
    ssc_codectypes = avi,ogg
    ssc_prog = /usr/local/bin/mt-daapd-ssc.pl
    logfile = /var/log/mt-daapd.log
    scan_type = 2
    plugin_dir = /usr/lib/mt-daapd/plugins
    plugins = rsp.so,ssc-ffmpeg.so,ssc-script.so

    Rebuilding the DB and connect with iTunes 7.5 on my MacOSX 10.4.11, I can find my movies.
    Trying to play one of the AVI’s gives (in firefly debug log (-d9)):

    Entering config_set_status
    Exiting config_set_status
    Session 0: Streaming file 'Filename.avi' to 192.168.1.1 (offset 0)
    Write error: Broken pipe
    Finished streaming file to remote: 274432 bytes
    Entering config_set_status
    Exiting config_set_status
    Executing: update songs set play_count=play_count + 1, time_played=1196428118 where id=1493
    Rows: 1
    Thread 0: Terminating
    Thread 0: Freeing request headers
    Thread 0: Freeing response headers
    Thread 0: Freeing request vars
    Thread 0: Closing fd
    With thread 0 exiting, 0 are still running

    File shows:

    Filename.avi: RIFF (little-endian) data, AVI, 640 x 240, 25.00 fps, video: XviD, audio: MPEG-1 Layer 3 (stereo, 48000 Hz)

    Transcoding it manually (with ffmpeg) to a MOV with extension .m4v works like a charm (sound and picture).

    The bad thing is that it don’t seem to call the ssc_prog script (it works like a charm in the shell). And the Write error: Broken pipe is also a little worrying…
    In no attempts, I’ve been able to get the ssc_prog script called. I’ve manually transcoded the file into a number of different formats with a number of different prefixes:

    Filename (avi-avi).avi: RIFF (little-endian) data, AVI, 640 x 240, 25.00 fps, video: XviD, audio: MPEG-1 Layer 3 (stereo, 48000 Hz)
    Filename (avi-m4v).m4v: RIFF (little-endian) data, AVI, 640 x 240, 25.00 fps, video: XviD, audio: MPEG-1 Layer 3 (stereo, 48000 Hz)
    Filename (m4v-m4v).m4v: MPEG sequence, v4, video, simple @ L1
    Filename (mov-m4v).m4v: ISO Media, Apple QuickTime movie
    Filename (mov-mov).mov: ISO Media, Apple QuickTime movie
    Filename (mpg-mp4).mp4: ISO Media, MPEG v4 system, version 1
    Filename (ogg-m4v).m4v: Ogg data, Vorbis audio, stereo, 48000 Hz, ~64000 bps, created by: Xiph.Org libVorbis I
    Filename (ogg-ogg).ogg: Ogg data, Vorbis audio, stereo, 48000 Hz, ~64000 bps, created by: Xiph.Org libVorbis I
    Filename (wav-m4v).m4v: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, stereo 48000 Hz
    Filename (wav-wav).wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, stereo 48000 Hz

    The first part (in the example mov-m4v) is the actual file format and the second the extension for this specific file (so that I know which file is which when I also try in XBMC).

    #14930
    Anonymous
    Inactive

    @turbo wrote:

    I’m trying to get iTunes to play my AVI files.

    Adding some debugging to plugin.c reveals that pi_ssc_should_transcode() get’s an unknown (unkn) codec for the AVI file, hence returns FALSE (don’t transcode)…

    #14931
    Anonymous
    Inactive

    Querying the DB directly shows:

    sqlite> select id,path,codectype from songs where path like '%Filename%' and codectype='unkn';
    1490|/share/Movies/Filename.avi|unkn
    1492|/share/Movies/tmp/Filename (mov-mov).mov|unkn
    1493|/share/Movies/tmp/Filename (avi-avi).avi|unkn

    Changing the unkn with avi works. Kinda… iTunes won’t start the playback.

    I added the undocumented option always_transcode = avi and then pi_ssc_should_transcode() returns TRUE.

    New log:

    ....
    Entering config_set_status
    Exiting config_set_status
    Session 0: Streaming file 'Filename (avi-avi).avi' to 192.168.1.1 (offset 0)
    Transcoding /share/Movies/tmp/Filename (avi-avi).avi with ssc-script/svn-1586
    Executing /usr/local/bin/mt-daapd-ssc.pl "/share/Movies/tmp/Filename "'('"avi-avi"')'".avi" 0 600.000 "avi"
    Updating Content-Type from application/x-dmap-tagged to audio/wav
    Updating Connection from close to Close
    Entering ws_writefd
    Exiting ws_writefd
    Entering ws_emitheaders
    Emitting reponse header Expires: -1
    Entering ws_writefd
    Exiting ws_writefd
    Emitting reponse header Cache-Control: no-cache
    Entering ws_writefd
    Exiting ws_writefd
    Emitting reponse header DAAP-Server: firefly/svn-1586
    Entering ws_writefd
    Exiting ws_writefd
    Emitting reponse header Accept-Ranges: bytes
    Entering ws_writefd
    Exiting ws_writefd
    Emitting reponse header Content-Language: en_us
    Entering ws_writefd
    Exiting ws_writefd
    Emitting reponse header Content-Type: audio/wav
    Entering ws_writefd
    Exiting ws_writefd
    Emitting reponse header Server: mt-daapd/svn-1586
    Entering ws_writefd
    Exiting ws_writefd
    Emitting reponse header Connection: Close
    Entering ws_writefd
    Exiting ws_writefd
    Emitting reponse header Date: Fri, 30 Nov 2007 14:58:45 GMT
    Entering ws_writefd
    Exiting ws_writefd
    Entering ws_writefd
    Exiting ws_writefd
    Exitin ws_emitheaders
    FFmpeg version SVN-rUNKNOWN, Copyright (c) 2000-2004 Fabrice Bellard
    configuration: --enable-gpl --enable-pp --enable-pthreads --enable-vorbis --enable-libogg --enable-a52 --enable-dts --enable-libgsm --enable-dc1394 --disable-debug --enable-mp3lame --enable-faadbin --enable-faad --enable-faac --enable-xvid --enable-shared --prefix=/usr
    libavutil version: 0d.49.0.0
    libavcodec version: 0d.51.11.0
    libavformat version: 0d.50.5.0
    built on Nov 29 2007 07:09:53, gcc: 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)
    Input #0, avi, from '/share/Movies/tmp/The Kingdom (avi-avi).avi':
    Duration: 01:43:19.4, start: 0.000000, bitrate: 946 kb/s
    Stream #0.0: Video: mpeg4, yuv420p, 640x240, 25.00 fps(r)
    Stream #0.1: Audio: mp3, 48000 Hz, stereo, 112 kb/s
    Output #0, wav, to 'pipe:':
    Stream #0.0: Audio: pcm_s16le, 48000 Hz, stereo, 1536 kb/s
    Stream mapping:
    Stream #0.1 -> #0.0
    Press [q] to stop encoding
    Write failed.
    ....

    The first problem (not considering that iTunes doesn’t play anything) is that there’s only one output stream (the video) – the audio stream is missing. WAV problem?

    #14932
    Anonymous
    Inactive

    Oki, for some reason it now works (I’ve restarted the server, that’s the only thing I know I did). Works in the way that I hear the sound, but don’t see the video…

    This is true both in the .avi and the AVI file with .m4v extension (I set all .m4v files to avi in the DB). For some reason, there’s now (?) no video stream in the output:

    Input #0, avi, from '/share/Movies/tmp/Filename (avi-avi).avi':
    Duration: 01:43:19.4, start: 0.000000, bitrate: 946 kb/s
    Stream #0.0: Video: mpeg4, yuv420p, 640x240, 25.00 fps(r)
    Stream #0.1: Audio: mp3, 48000 Hz, stereo, 112 kb/s
    Output #0, wav, to 'pipe:':
    Stream #0.0: Audio: pcm_s16le, 48000 Hz, stereo, 1536 kb/s
    Stream mapping:
    Stream #0.1 -> #0.0

    When playing Filename (avi-m4v).m4v mplayer is run like this:

    mplayer -quiet -really-quiet -vo null -nomouseinput -nojoystick -nolirc -noconsolecontrols -nortc -ao pcm:file=/tmp/t-967.wav /share/Movies/tmp/Filename (avi-m4v).m4v

    and there’s still no video. When playing the Filename (avi-avi).avi the script is using ffmpeg:

    ffmpeg -vn -i /share/Movies/tmp/Filename (avi-avi).avi -f wav -

    In both cases, iTunes Get Info say that it’s a WAV audio file. On the .avi file, the Video tab is grayed out.

    Hacking the script to call ffmpeg for .m4v files don’t help either. Only one (audio) stream as above…

    So… Conclution: If we can get ffmpeg/mplayer (or perhaps mencoder?) to write a WAV stream with both audio and audio, perhaps we can get this working… ?
    It would however be nice if FireFly could ‘fake’ the extension (show .avi files as .m4v or whatever) so I don’t have to rename all my files… AVI files don’t show up as video files in iTunes, hence the ‘fake’…

    #14933
    rpedde
    Participant

    @turbo wrote:

    Oki, for some reason it now works (I’ve restarted the server, that’s the only thing I know I did). Works in the way that I hear the sound, but don’t see the video…

    This is true both in the .avi and the AVI file with .m4v extension (I set all .m4v files to avi in the DB). For some reason, there’s now (?) no video stream in the output:

    Try updating the file in the db so that has_video is 1.

    — Ron

    #14934
    Anonymous
    Inactive

    @rpedde wrote:

    Try updating the file in the db so that has_video is 1.

    Tried that, didn’t work. Can’t even get ffmpeg to include the video if I run it manually in the shell

    [celia.pts/5]$ ffmpeg -y -i "/share/Movies/tmp/Filename (avi-avi).avi" -f wav /tmp/y
    FFmpeg version SVN-r11114, Copyright (c) 2000-2007 Fabrice Bellard, et al.
    configuration: --enable-gpl --enable-pp --enable-pthreads --enable-libvorbis --enable-liba52 --enable-libgsm --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-libdc1394 --disable-debug --enable-shared --prefix=/usr
    libavutil version: 49.5.0
    libavcodec version: 51.48.0
    libavformat version: 52.1.0
    built on Nov 30 2007 22:29:07, gcc: 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)
    Input #0, avi, from '/share/Movies/tmp/Filename (avi-avi).avi':
    Duration: 01:43:19.4, start: 0.000000, bitrate: 946 kb/s
    Stream #0.0: Video: mpeg4, yuv420p, 640x240 [PAR 1:1 DAR 8:3], 25.00 tb(r)
    Stream #0.1: Audio: mp3, 48000 Hz, stereo, 112 kb/s
    Output #0, wav, to '/tmp/y':
    Stream #0.0: Audio: pcm_s16le, 48000 Hz, stereo, 1536 kb/s
    Stream mapping:
    Stream #0.1 -> #0.0
    Press [q] to stop encoding

    This is latest SVN version of ffmpeg built this weekend.

    I’ve also tried to transcode it to MOV and ASF (with following params: ‘-vcodec msmpeg4 -acodec libmp3lame’). But in both cases, iTunes ‘hangs up’ for some reason (because it doesn’t understand the format?).

    I’m starting to wonder if it’s something wrong with my ffmpeg installation. I’ve been fiddeling with this all weekend, hacking the script and ssc-ffmpeg.so etc, but I just can’t get it to include the video. I’ve asked on the ffmpeg list, but so far no answer.

    #14935
    Anonymous
    Inactive

    @turbo wrote:

    I’m starting to wonder if it’s something wrong with my ffmpeg installation. I’ve been fiddeling with this all weekend, hacking the script and ssc-ffmpeg.so etc, but I just can’t get it to include the video. I’ve asked on the ffmpeg list, but so far no answer.

    Just got it verified – I have not been doing something wrong. WAV is a sound format only, so no wonder that the video is filtered out…

    But why is iTunes ‘hanging up’ the connection if I send it a MOV, MP4, ASF or MPEG stream!? It receives 45×4096 bytes, and then I get Broken pipe

    #14936
    rpedde
    Participant

    @turbo wrote:

    @turbo wrote:

    I’m starting to wonder if it’s something wrong with my ffmpeg installation. I’ve been fiddeling with this all weekend, hacking the script and ssc-ffmpeg.so etc, but I just can’t get it to include the video. I’ve asked on the ffmpeg list, but so far no answer.

    Just got it verified – I have not been doing something wrong. WAV is a sound format only, so no wonder that the video is filtered out…

    But why is iTunes ‘hanging up’ the connection if I send it a MOV, MP4, ASF or MPEG stream!? It receives 45×4096 bytes, and then I get Broken pipe

    if you didn’t care about transcoding audio, you could change ff-plugins.c to change the content-type from audio/wav to video/mpeg. that might do it.

    As far as itunes closing the connection, it does that when it doesn’t understand the header that it received, or it isn’t a streamable format (either because the qt component won’t work with a streaming file, or because the m4v/mov/mp4 metadata isn’t optimized for fast-start).

    #14937
    Anonymous
    Inactive

    @rpedde wrote:

    If you didn’t care about transcoding audio, you could change ff-plugins.c to change the content-type from audio/wav to video/mpeg. that might do it.

    Did that a couple of days ago, didn’t work either. @rpedde wrote:

    As far as itunes closing the connection, it does that when it doesn’t understand the header that it received, or it isn’t a streamable format (either because the qt component won’t work with a streaming file, or because the m4v/mov/mp4 metadata isn’t optimized for fast-start).

    I’m trying to figure out how to do this now. Seems I can’t use ffmpeg because that will require me to use qt-faststart to – leading to a to long delay – ~38 minutes to convert it to a MOV then an additional ~38 minutes to fix the header with qt-faststart.

    #14938
    rpedde
    Participant

    @turbo wrote:

    @rpedde wrote:

    If you didn’t care about transcoding audio, you could change ff-plugins.c to change the content-type from audio/wav to video/mpeg. that might do it.

    Did that a couple of days ago, didn’t work either. @rpedde wrote:

    As far as itunes closing the connection, it does that when it doesn’t understand the header that it received, or it isn’t a streamable format (either because the qt component won’t work with a streaming file, or because the m4v/mov/mp4 metadata isn’t optimized for fast-start).

    I’m trying to figure out how to do this now. Seems I can’t use ffmpeg because that will require me to use qt-faststart to – leading to a to long delay – ~38 minutes to convert it to a MOV then an additional ~38 minutes to fix the header with qt-faststart.

    Which I think is probably par for the course on any converter. Until it’s done transcoding, it doesn’t know for sure exactly how many frames there will be, or what the ultimate file size is going to be in bytes. I think you’ll end up having to write something like wavstreamer only for aac — something to dummy up the headers with “best guess” info based on bitrate or file duration and manually wrap the data.

    — Ron

    #14939
    Anonymous
    Inactive

    @rpedde wrote:

    @turbo wrote:

    @rpedde wrote:

    As far as itunes closing the connection, it does that when it doesn’t understand the header that it received, or it isn’t a streamable format (either because the qt component won’t work with a streaming file, or because the m4v/mov/mp4 metadata isn’t optimized for fast-start).

    I’m trying to figure out how to do this now. Seems I can’t use ffmpeg because that will require me to use qt-faststart to – leading to a to long delay – ~38 minutes to convert it to a MOV then an additional ~38 minutes to fix the header with qt-faststart.

    Which I think is probably par for the course on any converter. Until it’s done transcoding, it doesn’t know for sure exactly how many frames there will be, or what the ultimate file size is going to be in bytes.

    This can (should?) be done in the scanner. If it’s a movie (AVI, MOV, M4V, MP4 etc), then get all necessary information from the file, write it into a ‘headers’ table (in ‘header format’) in the database (in binary format, base64 or whatever is best/simplest).
    So when FireFly is to send the movie to the client, then first send the header then the file (skipping the header since it’s already sent).

Viewing 11 posts - 1 through 11 (of 11 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.