Opened 13 years ago
Closed 11 years ago
#11457 closed Bug Report - General (Duplicate)
Mythweb unable to download video (not recordings) over 64.5mb
| Reported by: | Owned by: | Rob Smith | |
|---|---|---|---|
| Priority: | minor | Milestone: | unknown |
| Component: | Plugin - MythWeb | Version: | 0.26-fixes |
| Severity: | medium | Keywords: | mythweb video download |
| Cc: | Ticket locked: | no |
Description
Hi,
Mythweb is unable to download vidoes that are over 64.5mb (recordings download/stream just fine)
I first thought it was a config error but just for the heck of it I put a 2.5mb .m4v file (under 64.5mb) in the vidoes/movies folder, clicked on the link in mythweb and it downloaded and started playing successfully.
Clicking on the video links in Safari it downloads 64.5mb for every movie, which are all over 1gb, the 2.5mb .m4v file downloads and plays successfully
Clicking on the video links in firefox however, returns an error page File not found Firefox can't find the file at http://192.168.0.100/mythweb/video/stream?Id=312. The 2.5mb .m4v file in mythweb downloads and plays just fine.
Videos mounted at /media/sdb/videos. .m4v files located on sdb under sdb/videos/Movies and sdb/videos/TV folders. The 2.5mb .m4v file downloads fine being placed in sdb/videos, sdb/videos/TV and sdb/videos/Movies
All videos play as expected in mythfrontend.
Attachments (1)
Change History (18)
comment:1 by , 13 years ago
comment:2 by , 13 years ago
I have clicked on 5 different videos and the log shows:
[Tue Mar 26 16:07:08 2013] [error] [client 192.168.0.6] PHP Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 64491521 bytes) in /usr/share/mythtv/mythweb/modules/video/stream.php on line 66, referer: http://192.168.0.100/mythweb/video [Tue Mar 26 16:07:12 2013] [error] [client 192.168.0.6] PHP Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 64491521 bytes) in /usr/share/mythtv/mythweb/modules/video/stream.php on line 66, referer: http://192.168.0.100/mythweb/video?path=%2FMovies [Tue Mar 26 16:07:14 2013] [error] [client 192.168.0.6] PHP Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 64491521 bytes) in /usr/share/mythtv/mythweb/modules/video/stream.php on line 66, referer: http://192.168.0.100/mythweb/video?path=%2FMovies [Tue Mar 26 16:08:00 2013] [error] [client 192.168.0.6] PHP Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 64491521 bytes) in /usr/share/mythtv/mythweb/modules/video/stream.php on line 66, referer: http://192.168.0.100/mythweb/video?path=%2FMovies [Tue Mar 26 16:08:29 2013] [error] [client 192.168.0.6] PHP Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 64491521 bytes) in /usr/share/mythtv/mythweb/modules/video/stream.php on line 66, referer: http://192.168.0.100/mythweb/video?path=%2FMovies
comment:3 by , 13 years ago
line 66 of /usr/share/mythtv/mythweb/modules/video/stream.ph is:
readfile("http://$Master_Host:$port/Content/GetVideo?Id=".$vid_id);
file contents:
<?php
/**
* Stream a music file
*
* @license GPL
*
* @package MythWeb
* @subpackage Music
/**/
// Yes, a db connection
global $db;
// Pull video ID
$vid_id = $_GET['Id'];
// Get filename
list($fname) = $db->query_row('SELECT filename
FROM videometadata
WHERE intid = ?', $vid_id);
// Mime type
switch (substr($fname, strrpos($fname, '.'))) {
case 'mpg':
case 'mpeg':
$mime = 'video/mpeg';
break;
case 'mp4':
$mime = 'video/mp4';
break;
case 'ogg':
case 'ogm':
case 'ogv':
$mime = 'video/ogg';
break;
case 'qt':
$mime = 'video/quicktime';
break;
case 'webm':
$mime = 'video/webm';
break;
case 'mkv':
$mime = 'video/x-matroska';
break;
case 'wmv':
$mime = 'video/x-ms-wmv';
break;
case 'flv':
$mime = 'video/x-flv';
break;
default:
$mime = 'applicatoin/octet-stream';
}
header('Content-Type: '.$mime);
// Send the filename
header('Content-Disposition: filename="'.$fname.'"');
// Send data via the backend
$Master_Host = setting('MasterServerIP');
$port = _or(get_backend_setting('BackendStatusPort', $Master_Host),
get_backend_setting('BackendStatusPort'));
if (stripos($Master_Host,':') !== false) {
$Master_Host = '['.$Master_Host.']';
}
readfile("http://$Master_Host:$port/Content/GetVideo?Id=".$vid_id);
// Nothing else to do
exit;
I've tried adding:
case 'm4v':
$mime = 'video/x-m4v';
to the file but made no difference.
comment:4 by , 13 years ago
Looks like you need to disable output_buffering (which defaults to off in PHP, but may have been turned on by your distro) in your PHP configuration. Please ask for help on mythtv-users mailing list if you have questions about how to do so. If this fixes the issue, please report back, here, and we will close the ticket.
comment:5 by , 13 years ago
| Status: | new → infoneeded_new |
|---|
comment:6 by , 13 years ago
locate php.ini
shows
/etc/php5/apache2/php.ini
/etc/php5/cli/php.ini
I changed
output_buffering = 4096
to
output_buffering = Off
in both of the files then rebooted
still cannot download the videos
comment:7 by , 13 years ago
This is the problem code in /usr/share/mythtv/mythweb/modules/video/stream.php it does not chunk the data like the recordings stream does.
Send data via the backend
$Master_Host = setting('MasterServerIP'); $port = _or(get_backend_setting('BackendStatusPort', $Master_Host),
get_backend_setting('BackendStatusPort'));
if (stripos($Master_Host,':') !== false) {
$Master_Host = '.$Master_Host.';
} readfile("http://$Master_Host:$port/Content/GetVideo?Id=".$vid_id);
comment:8 by , 13 years ago
http://php.net/manual/en/function.readfile.php
"readfile() will not present any memory issues, even when sending large files, on its own. If you encounter an out of memory error ensure that output buffering is off with ob_get_level()."
Keep looking for something that /is/ enabling output_buffering (and make sure you've properly restarted everything).
comment:9 by , 13 years ago
I'm also running into this problem on Ubuntu 13.04. Output_buffering is turned off. ob_get_level() returns 0 and phpinfo() shows output_buffering no value. What is going on here?
comment:10 by , 13 years ago
Ah, there is a ob_start(); in the mythweb init.php file that is causing this. If I flush the output buffer before the readfile, this works:
while (ob_get_level()) {
ob_end_flush();
}
comment:11 by , 12 years ago
| Status: | infoneeded_new → new |
|---|
comment:12 by , 12 years ago
See attachment
correct file type parsing add avi header type video/x-msvideo correct spelling of application clean object buffer
comment:13 by , 12 years ago
Thank you thank you thank you awaldram :-D I've updated the stream.php file, rebooted and its all working as expected :-)
comment:14 by , 12 years ago
| Component: | MythTV - General → Plugin - MythWeb |
|---|---|
| Owner: | set to |
comment:15 by , 12 years ago
It does not function for me.
I have upgraded mythbuntu 0.25 - there is no stream.php but I can see video in web browser
to 0.26 or 0.27 - new function stream.php but video in web browser do not function.
I changed to your new script, but it did not help me.
0.25 has good video output but bad imdb support 0.26 or 0.27 have better imdb support but no video output.
in all version of mythbuntu you will have to repair some scripts or database to use imdb :-(
I hope 0.28 will be better.
comment:16 by , 12 years ago
OP has version 0.26-fixes. This was fixed in mythweb 0.27, same solution as what he proposes. slavo.fabian should ask on mythtv-users or forum for help, not this bug.
Dupe of #11310
comment:17 by , 11 years ago
| Resolution: | → Duplicate |
|---|---|
| Status: | new → closed |

Anything in the apache error logs?