Please read the Ticket HowTo before creating or commenting on a ticket. Failure to do so may cause your ticket to be rejected or result in a slower response.
Opened 3 years ago
Closed 3 years ago
Last modified 3 years ago
#9036 closed patch (Fixed)
Fix for bug on flowplayer script
| Reported by: | mythtv@… | Owned by: | beirdo |
|---|---|---|---|
| Priority: | minor | Milestone: | 0.24.1 |
| Component: | Plugin - MythWeb | Version: | Master Head |
| Severity: | medium | Keywords: | flash flv flowplayer streaming |
| Cc: | Ticket locked: | no |
Description
The file stream_flv.pl in mythweb/modules/stream is responsible for on the fly transcoding to flv format, when using the flowplayer in MythWeb
For some reason ffmpeg is only able to transcode to a size with even height and width.
When calculating the screen size of the file to stream based on the size of the existing recording, the script attempts to use the function round_even in Math::Round to round to an even number. Unfortunately this function only rounds to an even number when rounding a decimal number, but in some cases, the value passed to round_even is an odd number without decimals. This causes ffmpeg to be launched with an odd target size, and ultimately fail.
The 3 calls to round_even in the script need to be replaced with calls to nearest_floor(2,
Which is part of the same Math::Round package. This will make sure to spit out only even integers and nothing else.
Attached is the modified script file. Please include this fix into the source code.
Attachments (2)
Change History (17)
Changed 3 years ago by anonymous
comment:1 Changed 3 years ago by robertm
- Status changed from new to infoneeded_new
Please attach a unified diff (diff -u or svn diff) rather than a raw file.
Changed 3 years ago by anonymous
Diff
comment:2 Changed 3 years ago by kormoc
- Milestone changed from unknown to 0.24
- Status changed from infoneeded_new to assigned
- Version changed from Unspecified to Trunk Head
comment:3 Changed 3 years ago by xris
- Resolution set to Duplicate
- Status changed from assigned to closed
comment:4 Changed 3 years ago by javamatte@…
The query is still wrong (at least for my system) in the stream_flv.pl script.
It gets the width/height using this query:
$sh = $dbh->prepare('SELECT data FROM recordedmarkup WHERE chanid=? AND starttime=FROM_UNIXTIME(?) AND data IS NOT NULL ORDER BY data DESC');
In my database, there is another datum added that might be the number of frames (type = 32) and is usually in the tens of thousands. So the width is set to 29000 and then the aspect ratio is calculated incorrectly.
Changing the query to this:
$sh = $dbh->prepare('SELECT data FROM recordedmarkup WHERE chanid=? AND starttime=FROM_UNIXTIME(?) AND data IS NOT NULL ORDER BY type');
sorts type = 30 first (this contains width in my DB), 31 second (this contains height) and then 32 (whatever the absurdly large number is).
I don't have the setup to provide a patch, but this is the only ref I found when googling the problem (squished video in mythweb streaming), so I figured I would post it here in case anyone was paying attention.
comment:5 Changed 3 years ago by beirdo
- Resolution Duplicate deleted
- Status changed from closed to new
comment:6 Changed 3 years ago by beirdo
- Owner changed from kormoc to beirdo
- Status changed from new to accepted
comment:7 Changed 3 years ago by beirdo
I will take a look at this revised bug. The query shown does seem absurd to me, shouldn't be hard to fix.
comment:8 Changed 3 years ago by justin.johnson3@…
I've been using this query to ignore the other type:
$dbh->prepare('SELECT data FROM recordedmarkup WHERE chanid=? AND starttime=FROM_UNIXTIME(?) AND mark<10 AND (TYPE=30 OR TYPE=31) AND data IS NOT NULL ORDER BY data DESC');
This grabs the initial size (I had an issue where the size would change on ads).
comment:9 Changed 3 years ago by beirdo
- Resolution set to Fixed
- Status changed from accepted to closed
comment:10 Changed 3 years ago by beirdo
comment:11 Changed 3 years ago by octoberblu3@…
This patch works properly when the video records cleanly, but when I get digital artifacts on my DTA, the analog recording has many entries for types 30 and 31. Here is a search on one such program:
| chanid | starttime | mark | type | data |
|---|---|---|---|---|
| 2041 | 2010-11-10 22:59:00 | 0 | 30 | 720 |
| 2041 | 2010-11-10 22:59:00 | 34461 | 30 | 2796 |
| 2041 | 2010-11-10 22:59:00 | 34464 | 30 | 720 |
| 2041 | 2010-11-10 22:59:00 | 36156 | 30 | 4094 |
| 2041 | 2010-11-10 22:59:00 | 36160 | 30 | 720 |
| 2041 | 2010-11-10 22:59:00 | 64478 | 30 | 6 |
| 2041 | 2010-11-10 22:59:00 | 64480 | 30 | 720 |
| 2041 | 2010-11-10 22:59:00 | 76205 | 30 | 3748 |
| 2041 | 2010-11-10 22:59:00 | 76210 | 30 | 720 |
| 2041 | 2010-11-10 22:59:00 | 0 | 31 | 480 |
| 2041 | 2010-11-10 22:59:00 | 34461 | 31 | 3840 |
| 2041 | 2010-11-10 22:59:00 | 34464 | 31 | 480 |
| 2041 | 2010-11-10 22:59:00 | 36156 | 31 | 98 |
| 2041 | 2010-11-10 22:59:00 | 36160 | 31 | 480 |
| 2041 | 2010-11-10 22:59:00 | 64478 | 31 | 3922 |
| 2041 | 2010-11-10 22:59:00 | 64480 | 31 | 480 |
| 2041 | 2010-11-10 22:59:00 | 76205 | 31 | 3568 |
| 2041 | 2010-11-10 22:59:00 | 76210 | 31 | 480 |
| 2041 | 2010-11-10 22:59:00 | 0 | 32 | 29970 |
Since this patch just takes the first two entries for the width and height, the aspect ratio is horribly off in Flowplayer (720x2796 scaled down).
Just adding in 'AND mark=0' in the query fixes this on my system.
comment:12 Changed 3 years ago by beirdo
- Resolution Fixed deleted
- Status changed from closed to new
comment:13 Changed 3 years ago by beirdo
- Milestone changed from 0.24 to 0.24.1
- Status changed from new to assigned
comment:14 Changed 3 years ago by beirdo
- Resolution set to Fixed
- Status changed from assigned to closed

Patched files