<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Неофициальный форум DLNA Home Media Server &mdash; ffprobe]]></title>
		<link>https://hms.lostcut.net/viewtopic.php?id=823</link>
		<atom:link href="https://hms.lostcut.net/extern.php?action=feed&amp;tid=823&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «ffprobe».]]></description>
		<lastBuildDate>Wed, 25 Nov 2020 13:01:47 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: ffprobe]]></title>
			<link>https://hms.lostcut.net/viewtopic.php?pid=17434#p17434</link>
			<description><![CDATA[<div class="quotebox"><cite>andrewbeats пишет:</cite><blockquote><p>Или может есть у кого скрипт на php для вытягивания подобной инфы:<br />HDR, <br />Кодек,<br />Разрешение видео,<br />Размер,<br />Битрейт,<br />Продолжительность</p></blockquote></div><p>Можете попробовать данную бибилиотеку, <a href="https://github.com/JamesHeinrich/getID3">https://github.com/JamesHeinrich/getID3</a><br />скачиваете её.</p><p>Далее для вывода всей информации о видео-файле используете примерно такой код</p><div class="codebox"><pre><code>&lt;?php 
require_once(&#039;getid3/getid3.php&#039;);# Путь к библиотеке

$filename=&#039;test.mp4&#039;;# Путь к Вашему видео-файле
$getID3 = new getID3; 
$file = $getID3-&gt;analyze($filename); 
print_r($file);

?&gt;</code></pre></div><p>По дальнейшему выводу на экран можно отыскать нужные места и вставить их в код, к примеру за время будет отвечать данный момент</p><div class="codebox"><pre><code>echo $file[&#039;playtime_string&#039;];</code></pre></div><p>За битрейт данный момент <br /></p><div class="codebox"><pre><code>echo $file[&#039;bitrate&#039;];</code></pre></div><p>Ну и так далее.</p><p>p/s данный метод работает с файлами сохраненными на Пк.</p>]]></description>
			<author><![CDATA[null@example.com (na-socke.tk)]]></author>
			<pubDate>Wed, 25 Nov 2020 13:01:47 +0000</pubDate>
			<guid>https://hms.lostcut.net/viewtopic.php?pid=17434#p17434</guid>
		</item>
		<item>
			<title><![CDATA[Re: ffprobe]]></title>
			<link>https://hms.lostcut.net/viewtopic.php?pid=17431#p17431</link>
			<description><![CDATA[<p>Или может есть у кого скрипт на php для вытягивания подобной инфы:<br />HDR, <br />Кодек,<br />Разрешение видео,<br />Размер,<br />Битрейт,<br />Продолжительность</p>]]></description>
			<author><![CDATA[null@example.com (andrewbeats)]]></author>
			<pubDate>Sun, 22 Nov 2020 10:56:52 +0000</pubDate>
			<guid>https://hms.lostcut.net/viewtopic.php?pid=17431#p17431</guid>
		</item>
		<item>
			<title><![CDATA[Re: ffprobe]]></title>
			<link>https://hms.lostcut.net/viewtopic.php?pid=17425#p17425</link>
			<description><![CDATA[<div class="quotebox"><cite>na-socke.tk пишет:</cite><blockquote><p> все удалить</p></blockquote></div><p>Ну если данный момент (ac3 5.1(side) rus) во всех случаях появляется&nbsp; то можно попробовать так <br />в данном месте<br /></p><div class="codebox"><pre><code> foreach ($key as $key2) { </code></pre></div><p>сразу после этого кода foreach ($key as $key2) { <br />ставим <br /></p><div class="codebox"><pre><code>$key2[tags][language] = preg_replace(&#039;#ac3\s*5\.1\(side\)\s*rus.*#&#039;,&#039;&#039;,$key2[tags][language]);</code></pre></div><p>Не во всех. Может быть одна звуковая дорожка</p>]]></description>
			<author><![CDATA[null@example.com (andrewbeats)]]></author>
			<pubDate>Fri, 20 Nov 2020 22:25:21 +0000</pubDate>
			<guid>https://hms.lostcut.net/viewtopic.php?pid=17425#p17425</guid>
		</item>
		<item>
			<title><![CDATA[Re: ffprobe]]></title>
			<link>https://hms.lostcut.net/viewtopic.php?pid=17424#p17424</link>
			<description><![CDATA[<div class="quotebox"><cite>andrewbeats пишет:</cite><blockquote><p>Всем привет!<br />Помогите с кодом<br /></p><div class="codebox"><pre><code>&lt;?php

$ffprobe = &#039;путь к ffprobe&#039;;
$videoFile = &#039;http://cdn.streambox.in/pd/kinopub/aWQ9ODIxMzUwOzE2MDU2MDE2ODE7NzQ0MzA4MjsxNjA1NzE2MTI4Jmg9S1NRYjkwTFdXbnRUSTBpYTFBbXd0dyZlPTE2MDU4MDI1Mjg/c/62/HipmvwdnSbMfvnrnV.mp4&#039;;
$cmd = shell_exec($ffprobe .&#039; -v quiet -show_format -show_streams -show_programs -show_chapters -show_private_data -print_format json  &quot;&#039;.$videoFile.&#039;&quot;&#039;);
$parsed = json_decode($cmd, true);
// print_r($parsed);

// Получаем кодек
echo &quot;Кодек: &quot;;
$codec = $parsed[streams][0][codec_name];
$codec = str_replace(&quot;h264&quot;, &quot;H.264&quot;, $codec);
$codec = str_replace(&quot;hevc&quot;, &quot;H.265 / HEVC&quot;, $codec);
$codec = str_replace(&quot;h265&quot;, &quot;H.265 / HEVC&quot;, $codec);
print_r($codec);

// Получаем HDR

$hdr = $parsed[streams][0][profile];
$hdr = str_replace(&quot;Main 10&quot;, &#039; /&lt;span style=&quot;color: #159ff6&quot;&gt; HDR&lt;/span&gt;&#039;, $hdr);
$hdr = str_replace(&quot;High&quot;, &quot;&quot;, $hdr);

print_r($hdr);
echo &#039;&lt;br /&gt;&#039;;

// Получаем Разрешение видео
echo &quot;Разрешение видео: &quot;;
print_r($parsed[streams][0][width]);
echo &quot;x&quot;;
print_r($parsed[streams][0][height]);
echo &#039;&lt;br /&gt;&#039;;

// Получаем Размер файла
function get_size( $bytes )
{
if ( $bytes &lt; 1000 * 1024 ) {
    return number_format( $bytes / 1024, 2 ) . &quot; KB&quot;;
}
    elseif ( $bytes &lt; 1000 * 1048576 ) {
        return number_format( $bytes / 1048576, 2 ) . &quot; MB&quot;;
}
 elseif ( $bytes &lt; 1000 * 1073741824 ) {
  return number_format( $bytes / 1073741824, 2 ) . &quot; GB&quot;;
  }
 else {
  return number_format( $bytes / 1099511627776, 2 ) . &quot; TB&quot;;
  }
 }
echo &quot;Размер: &quot;;
echo get_size( $parsed[format][size] );
echo &#039;&lt;br /&gt;&#039;;


// Получаем Битрейт файла
function get_bitrate( $bitrate )
{
if ( $bitrate &lt; 1000 * 1024 ) {
    return number_format( $bitrate / 1024, 2 ) . &quot; mb/s&quot;;
}
    elseif ( $bitrate &lt; 1000 * 1048576 ) {
        return number_format( $bitrate / 1048576, 2 ) . &quot; mb/s&quot;;
}
 elseif ( $bitrate &lt; 1000 * 1073741824 ) {
  return number_format( $bitrate / 1073741824, 2 ) . &quot; mb/s&quot;;
  }
 else {
  return number_format( $bitrate / 1099511627776, 2 ) . &quot; mb/s&quot;;
  }
 }
echo &quot;Битрейт: &quot;;
echo get_bitrate( $parsed[format][bit_rate] );
echo &#039;&lt;br /&gt;&#039;;


// Получаем Длительность видео
$time = $parsed[format][duration];
echo &quot;Продолжительность: &quot;;
echo $hours = floor($time/3600);
echo &quot;:&quot;;
echo floor($minutes = ($time/3600 - $hours)*60);
echo &quot;:&quot;;
echo $seconds = ceil(($minutes - floor($minutes))*60);


// Получаем звуковые дорожки
foreach ($parsed as $key) {
    // Кбираем первый элемент из массива
    unset($key[0]);

    foreach ($key as $key2) {
        echo &quot;&lt;pre&gt;&quot;;

        print_r($key2[index]);
        echo &quot;. &quot;;
        print_r($key2[streams][title]);
        echo &quot; &quot;;
        print_r($key2[codec_name]);
        echo &quot; &quot;;
        print_r($key2[channel_layout]);
        echo &quot; &quot;;
        print_r($key2[tags][language]);
        echo &quot;&lt;/pre&gt;&quot;;
    }

}


// echo &quot;&lt;pre&gt;&quot;;
// print_r($parsed);
// echo &quot;&lt;/pre&gt;&quot;;</code></pre></div><p>Вот что выводится</p><div class="codebox"><pre><code>Кодек: H.264
Разрешение видео: 3840x1600
Размер: 23.31 GB
Битрейт: 23.57 mb/s
Продолжительность: 2:15:4
1.  aac 5.1 rus
2.  aac 5.1 rus
3.  aac 5.1 rus
4.  aac 5.1 rus
5.  aac 5.1 rus
6.  aac 5.1 rus
7.  aac stereo ukr
8.  aac stereo ukr
9.  aac stereo ukr
10.  aac 5.1 eng
11.  ac3 5.1(side) rus
h. h h h h
.    
.    
m. m m m m
Q. Q Q Q Q
0. 0 0 0 0
8. 8 8 8 8
2. 2 2 2 2
2. 2 2 2 2
.    
.    </code></pre></div><p>Нужно чтобы отображались только звуковые дорожки<br />То есть после </p><div class="quotebox"><blockquote><p>11.&nbsp; ac3 5.1(side) rus</p></blockquote></div><p> все удалить</p></blockquote></div><p>Ну если данный момент (ac3 5.1(side) rus) во всех случаях появляется&nbsp; то можно попробовать так <br />в данном месте<br /></p><div class="codebox"><pre><code> foreach ($key as $key2) { </code></pre></div><p>сразу после этого кода foreach ($key as $key2) { <br />ставим <br /></p><div class="codebox"><pre><code>$key2[tags][language] = preg_replace(&#039;#ac3\s*5\.1\(side\)\s*rus.*#&#039;,&#039;&#039;,$key2[tags][language]);</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (na-socke.tk)]]></author>
			<pubDate>Thu, 19 Nov 2020 18:02:49 +0000</pubDate>
			<guid>https://hms.lostcut.net/viewtopic.php?pid=17424#p17424</guid>
		</item>
		<item>
			<title><![CDATA[ffprobe]]></title>
			<link>https://hms.lostcut.net/viewtopic.php?pid=17423#p17423</link>
			<description><![CDATA[<p>Всем привет!<br />Помогите с кодом<br /></p><div class="codebox"><pre><code>&lt;?php

$ffprobe = &#039;путь к ffprobe&#039;;
$videoFile = &#039;http://cdn.streambox.in/pd/kinopub/aWQ9ODIxMzUwOzE2MDU2MDE2ODE7NzQ0MzA4MjsxNjA1NzE2MTI4Jmg9S1NRYjkwTFdXbnRUSTBpYTFBbXd0dyZlPTE2MDU4MDI1Mjg/c/62/HipmvwdnSbMfvnrnV.mp4&#039;;
$cmd = shell_exec($ffprobe .&#039; -v quiet -show_format -show_streams -show_programs -show_chapters -show_private_data -print_format json  &quot;&#039;.$videoFile.&#039;&quot;&#039;);
$parsed = json_decode($cmd, true);
// print_r($parsed);

// Получаем кодек
echo &quot;Кодек: &quot;;
$codec = $parsed[streams][0][codec_name];
$codec = str_replace(&quot;h264&quot;, &quot;H.264&quot;, $codec);
$codec = str_replace(&quot;hevc&quot;, &quot;H.265 / HEVC&quot;, $codec);
$codec = str_replace(&quot;h265&quot;, &quot;H.265 / HEVC&quot;, $codec);
print_r($codec);

// Получаем HDR

$hdr = $parsed[streams][0][profile];
$hdr = str_replace(&quot;Main 10&quot;, &#039; /&lt;span style=&quot;color: #159ff6&quot;&gt; HDR&lt;/span&gt;&#039;, $hdr);
$hdr = str_replace(&quot;High&quot;, &quot;&quot;, $hdr);

print_r($hdr);
echo &#039;&lt;br /&gt;&#039;;

// Получаем Разрешение видео
echo &quot;Разрешение видео: &quot;;
print_r($parsed[streams][0][width]);
echo &quot;x&quot;;
print_r($parsed[streams][0][height]);
echo &#039;&lt;br /&gt;&#039;;

// Получаем Размер файла
function get_size( $bytes )
{
if ( $bytes &lt; 1000 * 1024 ) {
    return number_format( $bytes / 1024, 2 ) . &quot; KB&quot;;
}
    elseif ( $bytes &lt; 1000 * 1048576 ) {
        return number_format( $bytes / 1048576, 2 ) . &quot; MB&quot;;
}
 elseif ( $bytes &lt; 1000 * 1073741824 ) {
  return number_format( $bytes / 1073741824, 2 ) . &quot; GB&quot;;
  }
 else {
  return number_format( $bytes / 1099511627776, 2 ) . &quot; TB&quot;;
  }
 }
echo &quot;Размер: &quot;;
echo get_size( $parsed[format][size] );
echo &#039;&lt;br /&gt;&#039;;


// Получаем Битрейт файла
function get_bitrate( $bitrate )
{
if ( $bitrate &lt; 1000 * 1024 ) {
    return number_format( $bitrate / 1024, 2 ) . &quot; mb/s&quot;;
}
    elseif ( $bitrate &lt; 1000 * 1048576 ) {
        return number_format( $bitrate / 1048576, 2 ) . &quot; mb/s&quot;;
}
 elseif ( $bitrate &lt; 1000 * 1073741824 ) {
  return number_format( $bitrate / 1073741824, 2 ) . &quot; mb/s&quot;;
  }
 else {
  return number_format( $bitrate / 1099511627776, 2 ) . &quot; mb/s&quot;;
  }
 }
echo &quot;Битрейт: &quot;;
echo get_bitrate( $parsed[format][bit_rate] );
echo &#039;&lt;br /&gt;&#039;;


// Получаем Длительность видео
$time = $parsed[format][duration];
echo &quot;Продолжительность: &quot;;
echo $hours = floor($time/3600);
echo &quot;:&quot;;
echo floor($minutes = ($time/3600 - $hours)*60);
echo &quot;:&quot;;
echo $seconds = ceil(($minutes - floor($minutes))*60);


// Получаем звуковые дорожки
foreach ($parsed as $key) {
    // Кбираем первый элемент из массива
    unset($key[0]);

    foreach ($key as $key2) {
        echo &quot;&lt;pre&gt;&quot;;

        print_r($key2[index]);
        echo &quot;. &quot;;
        print_r($key2[streams][title]);
        echo &quot; &quot;;
        print_r($key2[codec_name]);
        echo &quot; &quot;;
        print_r($key2[channel_layout]);
        echo &quot; &quot;;
        print_r($key2[tags][language]);
        echo &quot;&lt;/pre&gt;&quot;;
    }

}


// echo &quot;&lt;pre&gt;&quot;;
// print_r($parsed);
// echo &quot;&lt;/pre&gt;&quot;;</code></pre></div><p>Вот что выводится</p><div class="codebox"><pre><code>Кодек: H.264
Разрешение видео: 3840x1600
Размер: 23.31 GB
Битрейт: 23.57 mb/s
Продолжительность: 2:15:4
1.  aac 5.1 rus
2.  aac 5.1 rus
3.  aac 5.1 rus
4.  aac 5.1 rus
5.  aac 5.1 rus
6.  aac 5.1 rus
7.  aac stereo ukr
8.  aac stereo ukr
9.  aac stereo ukr
10.  aac 5.1 eng
11.  ac3 5.1(side) rus
h. h h h h
.    
.    
m. m m m m
Q. Q Q Q Q
0. 0 0 0 0
8. 8 8 8 8
2. 2 2 2 2
2. 2 2 2 2
.    
.    </code></pre></div><p>Нужно чтобы отображались только звуковые дорожки<br />То есть после </p><div class="quotebox"><blockquote><p>11.&nbsp; ac3 5.1(side) rus</p></blockquote></div><p> все удалить</p>]]></description>
			<author><![CDATA[null@example.com (andrewbeats)]]></author>
			<pubDate>Wed, 18 Nov 2020 17:00:10 +0000</pubDate>
			<guid>https://hms.lostcut.net/viewtopic.php?pid=17423#p17423</guid>
		</item>
	</channel>
</rss>
