Opened 18 years ago

Closed 18 years ago

Last modified 17 years ago

#4644 closed patch (wontfix)

Fix to allow correct aspect ratio to play in mythweb flash player.

Reported by: anonymous Owned by: xris
Priority: minor Milestone: unknown
Component: mythweb Version: unknown
Severity: medium Keywords:
Cc: Ticket locked: no

Description

This is a patch to determine the aspect ratio of the video before playing in the mythweb flash player. Thus playing HD or none 4:3 aspect video correctly. Patch should be applied directly to handler.pl in the mythweb stream. Also fixed minor error in print statement.

Attachments (1)

streamhandler.diff (1.7 KB ) - added by anonymous 18 years ago.

Download all attachments as: .zip

Change History (8)

by anonymous, 18 years ago

Attachment: streamhandler.diff added

comment:1 by xris, 18 years ago

Resolution: invalid
Status: newclosed

I'm not accepting patches against this proof of concept for features that should be implemented properly in the backend.

comment:2 by xris, 18 years ago

Resolution: invalid
Status: closednew

comment:3 by xris, 18 years ago

Resolution: wontfix
Status: newclosed

comment:4 by anonymous, 18 years ago

Resolution: wontfix
Status: closednew

how can this be implemented in backend if the frame of the flash player is hard coded in the mythweb? The file being played has correct ratio, the flash player is the one that has the wrong aspect ratio, this cannot be implemented on backend side as backend is already playing correct ratio, the flash player needs to be adjusted accordingly and since its hard coded to 4:3, everything it plays (even if the source is 16:9) is displayed in 4:3.

comment:5 by stuartm, 18 years ago

Resolution: wontfix
Status: newclosed

The aspect ratio will be calculated on the backend at the time it is recorded and stored in the database. Mythweb will then use this information.

Your patch is not acceptable because it uses ffmpeg. The final version of the flash player in mythweb will not use ffmpeg at all and it won't be required on the web server.

comment:6 by anonymous, 17 years ago

Here is an updated version that works with 0.21-fixes and streams from my HD Homerun

tlunde@test810a6:~$ cat handler.pl.diff 103d102 < my $height = int($width * 10/16); 155c154 < <embed src="${web_root}tv/flvplayer.swf" width="$width" height="260" bgcolor="#FFFFFF" ---

<embed src="${web_root}tv/flvplayer.swf" width="320" height="260" bgcolor="#FFFFFF"

163,192d161 < < # Find out the video dimensions (this is a quick hack) < if (!open(FINFO,"$ffmpeg -y -i $filename -r 24 -f flv -ac 2 -ar 11025 -ab 64k -b 256k -vframes 1 -ss 65 /dev/null 2> /dev/stdout|")) { < print header(), < "Error: Can not get ffmpeg output for file $filename..\n"; < CORE::exit; < } < < my $horz; < my $vert; < < while (<FINFO>) { < if (/mpeg2video/) { < ($horz, $vert) = /\s(\d+)x(\d+)\s/; < last; < } < } < if (! $horz) { $horz=$width;} < if (! $vert) { $vert=$height;} < < $ratio = $vert / $horz; < $newhorz = $width; < $newvert = int($newhorz * $ratio); < < $newvert += $newvert % 8; # make the new vert a multiple of 8 < < close FINFO; < < < 194c163,170 < $ffmpeg_pid = open(DATA, "$ffmpeg -y -i $filename -s " . $newhorz . "x" . $newvert . " -r 24 -f flv -ac 2 -ar 11025 -ab 64k -b 256k /dev/stdout 2>/tmp/ffmpeg-output.log |"); ---

$ffmpeg_pid = open(DATA,

"$ffmpeg -y -i ".shell_escape($filename) .' -s '.shell_escape("${width}x$height") .' -r 24 -f flv -ac 2 -ar 11025' .' -ab '.shell_escape("${abitrate}k") .' -b '.shell_escape("${vbitrate}k") .' /dev/stdout 2>/dev/null |' );

tlunde@test810a6:~$

comment:7 by anonymous, 17 years ago

Ewwww. Sorry about that -- try this one:

tlunde@test810a6:~$ cat handler.pl.diff 
103d102
<     my $height = int($width * 10/16);
155c154
< <embed src="${web_root}tv/flvplayer.swf" width="$width" height="260" bgcolor="#FFFFFF"
---
> <embed src="${web_root}tv/flvplayer.swf" width="320" height="260" bgcolor="#FFFFFF"
163,192d161
< 
<   # Find out the video dimensions (this is a quick hack) 
<        if (!open(FINFO,"$ffmpeg -y -i $filename -r 24 -f flv -ac 2 -ar 11025 -ab 64k -b 256k -vframes 1 -ss 65 /dev/null 2> /dev/stdout|"))  {
<            print header(),  
<                "Error: Can not get ffmpeg output for file $filename..\n"; 
<            CORE::exit; 
<        } 
< 
<   my $horz; 
< 	        my $vert; 
< 	 
< 	        while (<FINFO>) { 
< 	            if (/mpeg2video/) { 
< 	                ($horz, $vert) = /\s(\d+)x(\d+)\s/; 
< 	                last; 
< 	            } 
< 	        } 
< if (! $horz) { $horz=$width;}
< if (! $vert) { $vert=$height;}
< 
<  $ratio = $vert / $horz; 
< 	        $newhorz = $width;
< 	        $newvert = int($newhorz * $ratio); 
< 	 
< 	        $newvert += $newvert % 8; # make the new vert a multiple of 8 
< 
<        close FINFO; 
< 
< 
< 
194c163,170
<  $ffmpeg_pid = open(DATA, "$ffmpeg -y -i $filename -s " . $newhorz . "x" . $newvert . " -r 24 -f flv -ac 2 -ar 11025 -ab 64k -b 256k /dev/stdout 2>/tmp/ffmpeg-output.log |"); 
---
>         $ffmpeg_pid = open(DATA,
>             "$ffmpeg -y -i ".shell_escape($filename)
>             .' -s '.shell_escape("${width}x$height")
>             .' -r 24 -f flv -ac 2 -ar 11025'
>             .' -ab '.shell_escape("${abitrate}k")
>             .' -b '.shell_escape("${vbitrate}k")
>             .' /dev/stdout 2>/dev/null |'
>             );
tlunde@test810a6:~$ 


Note: See TracTickets for help on using tickets.