diff --git a/web/skins/classic/views/frame.php b/web/skins/classic/views/frame.php index 9edaa0371..582ecb55f 100644 --- a/web/skins/classic/views/frame.php +++ b/web/skins/classic/views/frame.php @@ -28,7 +28,7 @@ $eid = validInt($_REQUEST['eid']); if ( !empty($_REQUEST['fid']) ) $fid = validInt($_REQUEST['fid']); -$sql = 'SELECT E.*,M.Name AS MonitorName,M.DefaultScale FROM Events AS E INNER JOIN Monitors AS M ON E.MonitorId = M.Id WHERE E.Id = ?'; +$sql = 'SELECT E.*,M.Name AS MonitorName,M.DefaultScale,M.VideoWriter FROM Events AS E INNER JOIN Monitors AS M ON E.MonitorId = M.Id WHERE E.Id = ?'; $event = dbFetchOne( $sql, NULL, array($eid) ); if ( !empty($fid) ) { @@ -75,7 +75,13 @@ xhtmlHeaders(__FILE__, translate('Frame')." - ".$event['Id']." - ".$frame['Frame

-

"><?php echo $frame['EventId']." class=""/>

+

+ + +"><?php echo $frame['EventId']." class=""/> + +

1 ) { ?> diff --git a/web/skins/classic/views/image-ffmpeg.php b/web/skins/classic/views/image-ffmpeg.php new file mode 100644 index 000000000..082c75099 --- /dev/null +++ b/web/skins/classic/views/image-ffmpeg.php @@ -0,0 +1,76 @@ +$fid, 'Type'=>'Normal', 'Score'=>0 ); +} else { + $frame = dbFetchOne( 'SELECT * FROM Frames WHERE EventId = ? AND Score = ?', NULL, array( $eid, $event['MaxScore'] ) ); +} + +$maxFid = $event['Frames']; + +$firstFid = 1; +$prevFid = $frame['FrameId']-1; +$nextFid = $frame['FrameId']+1; +$lastFid = $maxFid; + +$alarmFrame = $frame['Type']=='Alarm'; + +if ( isset( $_REQUEST['scale'] ) ) + $scale = validInt($_REQUEST['scale']); +else + $scale = max( reScale( SCALE_BASE, $event['DefaultScale'], ZM_WEB_DEFAULT_SCALE ), SCALE_BASE ); + +$Transpose = ''; +if ( $event['VideoWriter'] == "2" ) { + $Rotation = $event['Orientation']; +// rotate right + if ( in_array($event['Orientation'],array("90"))) + $Transpose = 'transpose=1,'; +// rotate 180 // upside down cam + if ( in_array($event['Orientation'],array("180"))) + $Transpose = 'transpose=2,transpose=2,'; +// rotate left + if ( in_array($event['Orientation'],array("270"))) + $Transpose = 'transpose=2,'; +} +$focusWindow = true; +$Scale = 100/$scale; +$fid = $fid - 1; +#$command = 'ffmpeg -v 0 -i '.getEventDefaultVideoPath($event).' -vf "select=gte(selected_n\,'.$fid.'),setpts=PTS-STARTPTS" '.$Transpose.',scale=iw/'.$Scale.':-1" -frames:v 1 -f mjpeg -'; +$command = 'ffmpeg -v 0 -i '.getEventDefaultVideoPath($event).' -vf "select=gte(n\\,'.$fid.'),setpts=PTS-STARTPTS,'.$Transpose.'scale=iw/'.$Scale.':-1" -f image2 -'; +header('Content-Type: image/jpeg'); +system($command); +?>