Modify

Ticket #4644 (closed patch: wontfix)

Opened 4 years ago

Last modified 4 years ago

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

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

Change History

Changed 4 years ago by anonymous

comment:1 Changed 4 years ago by xris

  • Status changed from new to closed
  • Resolution set to invalid

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

comment:2 Changed 4 years ago by xris

  • Status changed from closed to new
  • Resolution invalid deleted

comment:3 Changed 4 years ago by xris

  • Status changed from new to closed
  • Resolution set to wontfix

comment:4 Changed 4 years ago by anonymous

  • Status changed from closed to new
  • Resolution wontfix deleted

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 Changed 4 years ago by stuartm

  • Status changed from new to closed
  • Resolution set to wontfix

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 Changed 4 years ago by anonymous

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 Changed 4 years ago by anonymous

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:~$ 


View

Add a comment

Modify Ticket

Action
as closed
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.