Page 1 of 1

Cannot stream MKV and badly encoded AVI/divx

PostPosted: Mon Feb 21, 2011 1:39 pm
by dodob19
I can't stream any MKV files. I get a video not found or access denied error in JWPlayer (version 5). I'm running Subsonic version 4.4 on OS X.

AVI (divx) files work perfectly, except for badly encoded ones (more on that later).

This is the output of my ffmpeg -i movie.mkv:

Code: Select all
/Library/Application\ Support/Subsonic/transcode/ffmpeg -i movie.mkv
FFmpeg version SVN-r25203-einsteinx2, Copyright (c) 2000-2010 the FFmpeg developers
  built on Sep 26 2010 02:08:29 with gcc 4.2.1 (Apple Inc. build 5664)
  configuration: --prefix=/Volumes/Ramdisk/ --as=yasm --extra-version=einsteinx2 --disable-shared --enable-static --disable-ffplay --disable-ffserver --enable-gpl --enable-pthreads --enable-postproc --enable-gray --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-libspeex --enable-bzlib --enable-zlib --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-nonfree --enable-version3
  libavutil     50.28. 0 / 50.28. 0
  libavcore      0. 9. 0 /  0. 9. 0
  libavcodec    52.90. 0 / 52.90. 0
  libavformat   52.78. 5 / 52.78. 5
  libavdevice   52. 2. 2 / 52. 2. 2
  libavfilter    1.45. 0 /  1.45. 0
  libswscale     0.11. 0 /  0.11. 0
  libpostproc   51. 2. 0 / 51. 2. 0
[matroska,webm @ 0x1809600] Estimating duration from bitrate, this may be inaccurate

Seems stream 0 codec frame rate differs from container frame rate: 47.95 (48000/1001) -> 24.00 (24/1)
Input #0, matroska,webm, from 'movie.mkv':
  Duration: 00:44:24.66, start: 0.000000, bitrate: 448 kb/s
    Stream #0.0(eng): Video: h264, yuv420p, 1280x720, PAR 1:1 DAR 16:9, 23.98 fps, 24 tbr, 1k tbn, 47.95 tbc
    Stream #0.1: Audio: ac3, 48000 Hz, 5.1, s16, 448 kb/s
At least one output file must be specified


In Subsonic's About log, when I play the file, I get the above and also:
Code: Select all

[2/21/11 9:34:32 PM CST]   DEBUG   InputStreamReaderThread   (/Library/Application Support/Subsonic/transcode/ffmpeg) [buffer @ 0x1104c90] w:1280 h:720 pixfmt:yuv420p
[2/21/11 9:34:32 PM CST]   DEBUG   InputStreamReaderThread   (/Library/Application Support/Subsonic/transcode/ffmpeg) [scale @ 0x1104ea0] w:1280 h:720 fmt:yuv420p -> w:640 h:360 fmt:yuv420p flags:0xc0000004
[2/21/11 9:34:32 PM CST]   DEBUG   InputStreamReaderThread   (/Library/Application Support/Subsonic/transcode/ffmpeg) Output #0, flv, to 'pipe:':
[2/21/11 9:34:32 PM CST]   DEBUG   InputStreamReaderThread   (/Library/Application Support/Subsonic/transcode/ffmpeg) Metadata:
[2/21/11 9:34:32 PM CST]   DEBUG   InputStreamReaderThread   (/Library/Application Support/Subsonic/transcode/ffmpeg) encoder : Lavf52.78.5
[2/21/11 9:34:32 PM CST]   DEBUG   InputStreamReaderThread   (/Library/Application Support/Subsonic/transcode/ffmpeg) Stream #0.0(eng): Video: flv, yuv420p, 640x360 [PAR 1:1 DAR 16:9], q=2-31, 1000 kb/s, 1k tbn, 24 tbc
[2/21/11 9:34:32 PM CST]   DEBUG   InputStreamReaderThread   (/Library/Application Support/Subsonic/transcode/ffmpeg) Stream #0.1: Audio: libmp3lame, 44100 Hz, 2 channels, s16, 64 kb/s
[2/21/11 9:34:32 PM CST]   DEBUG   InputStreamReaderThread   (/Library/Application Support/Subsonic/transcode/ffmpeg) Stream mapping:
[2/21/11 9:34:32 PM CST]   DEBUG   InputStreamReaderThread   (/Library/Application Support/Subsonic/transcode/ffmpeg) Stream #0.0 -> #0.0
[2/21/11 9:34:32 PM CST]   DEBUG   InputStreamReaderThread   (/Library/Application Support/Subsonic/transcode/ffmpeg) Stream #0.1 -> #0.1
[2/21/11 9:34:32 PM CST]   DEBUG   InputStreamReaderThread   (/Library/Application Support/Subsonic/transcode/ffmpeg) Press [q] to stop encoding


... which seems to indicate it might be working.

My Subsonic>Settings>Transcoding settings are default. All video conversions including mkv to flv are:
Code: Select all
ffmpeg -ss %o -i %s -async 1 -b %bk -s %wx%h -ar 44100 -ac 2 -v 0 -f flv -


Any suggestions would be appreciated :)

About badly encoded AVI files

PostPosted: Mon Feb 21, 2011 2:01 pm
by dodob19
Some of my AVI files fail to play with the same "video not found or access denied" error in JWplayer.

The Subsonic>About log for a failed AVI transcode reads:

Code: Select all
[2/21/11 9:55:55 PM CST]    INFO   PlaylistInputStream   admin listening to "movie.avi"
[2/21/11 9:55:55 PM CST]    DEBUG   TranscodeInputStream   Starting transcoder: [/Library/Application Support/Subsonic/transcode/ffmpeg] [-ss] [0] [-i] [/Users/bob/movies/movie.avi] [-async] [1] [-b] [1000k] [-s] [480x360] [-ar] [44100] [-ac] [2] [-v] [0] [-f] [flv] [-]
[2/21/11 9:55:55 PM CST]    DEBUG   InputStreamReaderThread   (/Library/Application Support/Subsonic/transcode/ffmpeg) FFmpeg version SVN-r25203-einsteinx2, Copyright (c) 2000-2010 the FFmpeg developers
[2/21/11 9:55:55 PM CST]    DEBUG   InputStreamReaderThread   (/Library/Application Support/Subsonic/transcode/ffmpeg) built on Sep 26 2010 02:08:29 with gcc 4.2.1 (Apple Inc. build 5664)
[2/21/11 9:55:55 PM CST]    DEBUG   InputStreamReaderThread   (/Library/Application Support/Subsonic/transcode/ffmpeg) configuration: --prefix=/Volumes/Ramdisk/ --as=yasm --extra-version=einsteinx2 --disable-shared --enable-static --disable-ffplay --disable-ffserver --enable-gpl --enable-pthreads --enable-postproc --enable-gray --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-libspeex --enable-bzlib --enable-zlib --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-nonfree --enable-version3
[2/21/11 9:55:55 PM CST]    DEBUG   InputStreamReaderThread   (/Library/Application Support/Subsonic/transcode/ffmpeg) libavutil 50.28. 0 / 50.28. 0
[2/21/11 9:55:55 PM CST]    DEBUG   InputStreamReaderThread   (/Library/Application Support/Subsonic/transcode/ffmpeg) libavcore 0. 9. 0 / 0. 9. 0
[2/21/11 9:55:55 PM CST]    DEBUG   InputStreamReaderThread   (/Library/Application Support/Subsonic/transcode/ffmpeg) libavcodec 52.90. 0 / 52.90. 0
[2/21/11 9:55:55 PM CST]    DEBUG   InputStreamReaderThread   (/Library/Application Support/Subsonic/transcode/ffmpeg) libavformat 52.78. 5 / 52.78. 5
[2/21/11 9:55:55 PM CST]    DEBUG   InputStreamReaderThread   (/Library/Application Support/Subsonic/transcode/ffmpeg) libavdevice 52. 2. 2 / 52. 2. 2
[2/21/11 9:55:55 PM CST]    DEBUG   InputStreamReaderThread   (/Library/Application Support/Subsonic/transcode/ffmpeg) libavfilter 1.45. 0 / 1.45. 0
[2/21/11 9:55:55 PM CST]    DEBUG   InputStreamReaderThread   (/Library/Application Support/Subsonic/transcode/ffmpeg) libswscale 0.11. 0 / 0.11. 0
[2/21/11 9:55:55 PM CST]    DEBUG   InputStreamReaderThread   (/Library/Application Support/Subsonic/transcode/ffmpeg) libpostproc 51. 2. 0 / 51. 2. 0
[2/21/11 9:55:55 PM CST]    DEBUG   InputStreamReaderThread   (/Library/Application Support/Subsonic/transcode/ffmpeg) [mpeg4 @ 0x1812600] Invalid and inefficient vfw-avi packed B frames detected
[2/21/11 9:55:55 PM CST]    DEBUG   InputStreamReaderThread   (/Library/Application Support/Subsonic/transcode/ffmpeg)
[2/21/11 9:55:55 PM CST]    DEBUG   InputStreamReaderThread   (/Library/Application Support/Subsonic/transcode/ffmpeg) Seems stream 0 codec frame rate differs from container frame rate: 23.98 (65535/2733) -> 23.98 (2997/125)
[2/21/11 9:55:55 PM CST]    DEBUG   InputStreamReaderThread   (/Library/Application Support/Subsonic/transcode/ffmpeg) Input #0, avi, from '/Users/bob/movies/movie.avi':
[2/21/11 9:55:55 PM CST]    DEBUG   InputStreamReaderThread   (/Library/Application Support/Subsonic/transcode/ffmpeg) Metadata:
[2/21/11 9:55:55 PM CST]    DEBUG   InputStreamReaderThread   (/Library/Application Support/Subsonic/transcode/ffmpeg) ISFT : VirtualDubMod 1.5.10.2 (build 2540/release)
[2/21/11 9:55:55 PM CST]    DEBUG   InputStreamReaderThread   (/Library/Application Support/Subsonic/transcode/ffmpeg) Duration: 00:22:48.03, start: 0.000000, bitrate: 1061 kb/s
[2/21/11 9:55:55 PM CST]    DEBUG   InputStreamReaderThread   (/Library/Application Support/Subsonic/transcode/ffmpeg) Stream #0.0: Video: mpeg4, yuv420p, 576x432 [PAR 1:1 DAR 4:3], 23.98 tbr, 23.98 tbn, 23.98 tbc
[2/21/11 9:55:55 PM CST]    DEBUG   InputStreamReaderThread   (/Library/Application Support/Subsonic/transcode/ffmpeg) Stream #0.1: Audio: ac3, 48000 Hz, stereo, s16, 192 kb/s
[2/21/11 9:55:55 PM CST]    DEBUG   InputStreamReaderThread   (/Library/Application Support/Subsonic/transcode/ffmpeg) [buffer @ 0x1101a60] w:576 h:432 pixfmt:yuv420p
[2/21/11 9:55:55 PM CST]    DEBUG   InputStreamReaderThread   (/Library/Application Support/Subsonic/transcode/ffmpeg) [scale @ 0x1101c90] w:576 h:432 fmt:yuv420p -> w:480 h:360 fmt:yuv420p flags:0xc0000004
[2/21/11 9:55:55 PM CST]    DEBUG   InputStreamReaderThread   (/Library/Application Support/Subsonic/transcode/ffmpeg) Output #0, flv, to 'pipe:':
[2/21/11 9:55:55 PM CST]    DEBUG   InputStreamReaderThread   (/Library/Application Support/Subsonic/transcode/ffmpeg) Metadata:
[2/21/11 9:55:55 PM CST]    DEBUG   InputStreamReaderThread   (/Library/Application Support/Subsonic/transcode/ffmpeg) encoder : Lavf52.78.5
[2/21/11 9:55:55 PM CST]    DEBUG   InputStreamReaderThread   (/Library/Application Support/Subsonic/transcode/ffmpeg) Stream #0.0: Video: flv, yuv420p, 480x360 [PAR 1:1 DAR 4:3], q=2-31, 1000 kb/s, 1k tbn, 23.98 tbc
[2/21/11 9:55:55 PM CST]    DEBUG   InputStreamReaderThread   (/Library/Application Support/Subsonic/transcode/ffmpeg) Stream #0.1: Audio: libmp3lame, 44100 Hz, stereo, s16, 64 kb/s
[2/21/11 9:55:55 PM CST]    DEBUG   InputStreamReaderThread   (/Library/Application Support/Subsonic/transcode/ffmpeg) Stream mapping:
[2/21/11 9:55:55 PM CST]    DEBUG   InputStreamReaderThread   (/Library/Application Support/Subsonic/transcode/ffmpeg) Stream #0.0 -> #0.0
[2/21/11 9:55:55 PM CST]    DEBUG   InputStreamReaderThread   (/Library/Application Support/Subsonic/transcode/ffmpeg) Stream #0.1 -> #0.1
[2/21/11 9:55:55 PM CST]    DEBUG   InputStreamReaderThread   (/Library/Application Support/Subsonic/transcode/ffmpeg) Press [q] to stop encoding
[2/21/11 9:55:55 PM CST]    DEBUG   InputStreamReaderThread   (/Library/Application Support/Subsonic/transcode/ffmpeg) [mpeg4 @ 0x1812600] Invalid and inefficient vfw-avi packed B frames detected


Is there a way to make ffmpeg ignore the "invalid and inefficient vfw-avi packed B frames detected" error/warning?

If not, is there a utility to batch-check a bunch of AVIs for validity, and a tool to fix them?

PostPosted: Mon Feb 21, 2011 4:18 pm
by dodob19
Got both of the above working by compiling my own ffmpeg :)

Subsonic for OS X 4.4 (build 2169) – February 6, 2011

Default pack-in ffmpeg ( /Library/Application Support/Subsonic/transcode/ffmpeg )
Code: Select all
FFmpeg version SVN-r25203-einsteinx2, Copyright (c) 2000-2010 the FFmpeg developers
  built on Sep 26 2010 02:08:29 with gcc 4.2.1 (Apple Inc. build 5664)
  configuration: --prefix=/Volumes/Ramdisk/ --as=yasm --extra-version=einsteinx2 --disable-shared --enable-static --disable-ffplay --disable-ffserver --enable-gpl --enable-pthreads --enable-postproc --enable-gray --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-libspeex --enable-bzlib --enable-zlib --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-nonfree --enable-version3
  libavutil     50.28. 0 / 50.28. 0
  libavcore      0. 9. 0 /  0. 9. 0
  libavcodec    52.90. 0 / 52.90. 0
  libavformat   52.78. 5 / 52.78. 5
  libavdevice   52. 2. 2 / 52. 2. 2
  libavfilter    1.45. 0 /  1.45. 0
  libswscale     0.11. 0 /  0.11. 0
  libpostproc   51. 2. 0 / 51. 2. 0


Recompiled ffmpeg
Code: Select all
FFmpeg version SVN-r26402, Copyright (c) 2000-2011 the FFmpeg developers
  built on Feb 21 2011 23:54:55 with gcc 4.2.1 (Apple Inc. build 5664)
  configuration: --enable-libmp3lame --enable-shared --disable-mmx --arch=x86_64
  libavutil     50.36. 0 / 50.36. 0
  libavcore      0.16. 1 /  0.16. 1
  libavcodec    52.108. 0 / 52.108. 0
  libavformat   52.93. 0 / 52.93. 0
  libavdevice   52. 2. 3 / 52. 2. 3
  libavfilter    1.74. 0 /  1.74. 0
  libswscale     0.12. 0 /  0.12. 0


I used a lot less switches. Should I be recompiling it with some switches found in the default ffmpeg (enable-gpl, enable-pthreads, enable-postproc, enable-gray, enable-nonfree, etc.)?

PostPosted: Mon Feb 21, 2011 4:33 pm
by dodob19
For those interested, here's what I did:

Get lame source and compile it (required to build ffmpeg with --enable-libmp3lame). Grab the latest lame source from http://sourceforge.net/projects/lame/files/lame/
Code: Select all
tar xvzf lame-3.98.4.tar.gz
cd lame-3.98.4/
./configure
sudo make install


Grab the latest ffmpeg and built it:
Code: Select all
svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
cd ffmpeg/
./configure --enable-libmp3lame --enable-shared --disable-mmx --arch=x86_64
make
sudo make install


Replace the old ffmpeg with the new one:
Code: Select all
cd /Library/Application Support/Subsonic/transcode/
mv ffmpeg ffmpeg.old
ln -s /usr/local/bin/ffmpeg .



There is still a problem with file seeking. Clicking anywhere on the time seeking bar and the video will reset from the beginning.

PostPosted: Wed Mar 09, 2011 12:18 pm
by muiz
Not all of us can compile, so.. no use for us

PostPosted: Wed Mar 23, 2011 11:19 am
by twoolums
dodob19 I wanted to say thank you. I followed your steps on my Mac OS X 10.6, Subsonic 4.4 install to get my avi (divx) files to stream. I couldn't even get them to stream without getting that Video not found or access denied error. Works like a charm now!


muiz wrote:Not all of us can compile, so.. no use for us


Why can't you...I couldn't at first. Install Xcode (its in the App store for 5 bucks) from Apple and then you're good to go.

PostPosted: Wed Mar 23, 2011 3:00 pm
by GJ51
Try:

ffmpeg -v 0 -ss %o -async 30 -i %s -f flv -b %bk -r 23.976 -s %wx%h -acodec copy -

or

ffmpeg -v 0 -ss %o -async 30 -i %s -f flv -b %bk -r 23.976 -s %wx%h -ar 44100 -ac 2 -

Yeah!

PostPosted: Tue Mar 29, 2011 4:15 am
by mgiffels
I was getting the same "Video not found" error. Recompiling worked! I am having the seek problem that you were talking about though, dodob19. Any fix on that yet?

PostPosted: Tue Mar 29, 2011 1:53 pm
by mgiffels
Just wanted to add another quick update that I was still having trouble streaming certain files. Using the second line from GJ51 fixed the problem.

ffmpeg -v 0 -ss %o -async 30 -i %s -f flv -b %bk -r 23.976 -s %wx%h -ar 44100 -ac 2 -

Thanks for figuring these things out. You've made my work day a little more bearable.

PostPosted: Fri Apr 29, 2011 4:14 pm
by countzer0
Thanks dodob19, updating ffmpeg worked for me! Before that, I had only been able to play XviD/avi and a very small percentage of x264/mkv. Also, transcoding to a lower bitrate did not work. All fixed now, thanks.

BTW, you can get Xcode (without having to buy the app) from your Mac OS X install disc, under Optional Installs...

Recompiling FFMPEG fixed my issues on OSX as well

PostPosted: Wed Jun 15, 2011 7:04 pm
by jameskeagie
Following the steps above to re-compile resolved my issues as well. Like the rest, I still cannot scan/seek to a time.

I had multiple issues with AVI, DIVX, mkv/x264 before, as well as down-sampling to a lower bitrate on AVI's. These are all now resolved.

I will continue to play videos and see if I run into any more issues.

As far as GJ51's transcoding commands, they broke any streaming to flv on my Android devices. I am not sure why - but switching back to the default restored streaming to my Android browser. I will continue testing to see if it is necessary. If so - I'll have to set up a player/user for mobile use only with the default transcoding command.

Thanks for all your awesome help guys on this forum!

PostPosted: Wed Jun 15, 2011 7:13 pm
by GJ51

Re:

PostPosted: Thu Feb 02, 2012 6:41 pm
by cryptworks
GJ51 wrote:Try:

ffmpeg -v 0 -ss %o -async 30 -i %s -f flv -b %bk -r 23.976 -s %wx%h -acodec copy -

or

ffmpeg -v 0 -ss %o -async 30 -i %s -f flv -b %bk -r 23.976 -s %wx%h -ar 44100 -ac 2 -


Had similar issues, The second option above worked like a champ!! very nice, and quite graceful!