
Recherche avancée
Médias (1)
-
Bug de détection d’ogg
22 mars 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Video
Autres articles (62)
-
Dépôt de média et thèmes par FTP
31 mai 2013, parL’outil MédiaSPIP traite aussi les média transférés par la voie FTP. Si vous préférez déposer par cette voie, récupérez les identifiants d’accès vers votre site MédiaSPIP et utilisez votre client FTP favori.
Vous trouverez dès le départ les dossiers suivants dans votre espace FTP : config/ : dossier de configuration du site IMG/ : dossier des média déjà traités et en ligne sur le site local/ : répertoire cache du site web themes/ : les thèmes ou les feuilles de style personnalisées tmp/ : dossier de travail (...) -
La file d’attente de SPIPmotion
28 novembre 2010, parUne file d’attente stockée dans la base de donnée
Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...) -
Changer le statut par défaut des nouveaux inscrits
26 décembre 2015, parPar défaut, lors de leur inscription, les nouveaux utilisateurs ont le statut de visiteur. Ils disposent de certains droits mais ne peuvent pas forcément publier leurs contenus eux-même etc...
Il est possible de changer ce statut par défaut. en "rédacteur".
Pour ce faire, un administrateur webmestre du site doit aller dans l’espace privé de SPIP en ajoutant ecrire/ à l’url de son site.
Une fois dans l’espace privé, il lui faut suivre les menus configuration > Interactivité et activer (...)
Sur d’autres sites (7354)
-
Cutting a live stream into separate mp4 files
9 juin 2017, par FearhunterI am doing a research for cutting a live stream in piece and save it as mp4 files. I am using this source for the proof of concept :
And this is the example code I use :
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Net;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using Microsoft.WindowsAzure.MediaServices.Client;
using Newtonsoft.Json.Linq;
namespace AMSLiveTest
{
class Program
{
private const string StreamingEndpointName = "streamingendpoint001";
private const string ChannelName = "channel001";
private const string AssetlName = "asset001";
private const string ProgramlName = "program001";
// Read values from the App.config file.
private static readonly string _mediaServicesAccountName =
ConfigurationManager.AppSettings["MediaServicesAccountName"];
private static readonly string _mediaServicesAccountKey =
ConfigurationManager.AppSettings["MediaServicesAccountKey"];
// Field for service context.
private static CloudMediaContext _context = null;
private static MediaServicesCredentials _cachedCredentials = null;
static void Main(string[] args)
{
// Create and cache the Media Services credentials in a static class variable.
_cachedCredentials = new MediaServicesCredentials(
_mediaServicesAccountName,
_mediaServicesAccountKey);
// Used the cached credentials to create CloudMediaContext.
_context = new CloudMediaContext(_cachedCredentials);
IChannel channel = CreateAndStartChannel();
// Set the Live Encoder to point to the channel's input endpoint:
string ingestUrl = channel.Input.Endpoints.FirstOrDefault().Url.ToString();
// Use the previewEndpoint to preview and verify
// that the input from the encoder is actually reaching the Channel.
string previewEndpoint = channel.Preview.Endpoints.FirstOrDefault().Url.ToString();
IProgram program = CreateAndStartProgram(channel);
ILocator locator = CreateLocatorForAsset(program.Asset, program.ArchiveWindowLength);
IStreamingEndpoint streamingEndpoint = CreateAndStartStreamingEndpoint();
GetLocatorsInAllStreamingEndpoints(program.Asset);
// Once you are done streaming, clean up your resources.
Cleanup(streamingEndpoint, channel);
}
public static IChannel CreateAndStartChannel()
{
//If you want to change the Smooth fragments to HLS segment ratio, you would set the ChannelCreationOptions’s Output property.
IChannel channel = _context.Channels.Create(
new ChannelCreationOptions
{
Name = ChannelName,
Input = CreateChannelInput(),
Preview = CreateChannelPreview()
});
//Starting and stopping Channels can take some time to execute. To determine the state of operations after calling Start or Stop, query the IChannel.State .
channel.Start();
return channel;
}
private static ChannelInput CreateChannelInput()
{
return new ChannelInput
{
StreamingProtocol = StreamingProtocol.RTMP,
AccessControl = new ChannelAccessControl
{
IPAllowList = new List<iprange>
{
new IPRange
{
Name = "TestChannelInput001",
// Setting 0.0.0.0 for Address and 0 for SubnetPrefixLength
// will allow access to IP addresses.
Address = IPAddress.Parse("0.0.0.0"),
SubnetPrefixLength = 0
}
}
}
};
}
private static ChannelPreview CreateChannelPreview()
{
return new ChannelPreview
{
AccessControl = new ChannelAccessControl
{
IPAllowList = new List<iprange>
{
new IPRange
{
Name = "TestChannelPreview001",
// Setting 0.0.0.0 for Address and 0 for SubnetPrefixLength
// will allow access to IP addresses.
Address = IPAddress.Parse("0.0.0.0"),
SubnetPrefixLength = 0
}
}
}
};
}
public static void UpdateCrossSiteAccessPoliciesForChannel(IChannel channel)
{
var clientPolicy =
@"<?xml version=""1.0"" encoding=""utf-8""?>
<policy>
<domain uri=""></domain>
<resource path=""></resource>"" include-subpaths=""true""/>
</policy>
";
var xdomainPolicy =
@"<?xml version=""1.0"" ?>
";
channel.CrossSiteAccessPolicies.ClientAccessPolicy = clientPolicy;
channel.CrossSiteAccessPolicies.CrossDomainPolicy = xdomainPolicy;
channel.Update();
}
public static IProgram CreateAndStartProgram(IChannel channel)
{
IAsset asset = _context.Assets.Create(AssetlName, AssetCreationOptions.None);
// Create a Program on the Channel. You can have multiple Programs that overlap or are sequential;
// however each Program must have a unique name within your Media Services account.
IProgram program = channel.Programs.Create(ProgramlName, TimeSpan.FromHours(3), asset.Id);
program.Start();
return program;
}
public static ILocator CreateLocatorForAsset(IAsset asset, TimeSpan ArchiveWindowLength)
{
// You cannot create a streaming locator using an AccessPolicy that includes write or delete permissions.
var locator = _context.Locators.CreateLocator
(
LocatorType.OnDemandOrigin,
asset,
_context.AccessPolicies.Create
(
"Live Stream Policy",
ArchiveWindowLength,
AccessPermissions.Read
)
);
return locator;
}
public static IStreamingEndpoint CreateAndStartStreamingEndpoint()
{
var options = new StreamingEndpointCreationOptions
{
Name = StreamingEndpointName,
ScaleUnits = 1,
AccessControl = GetAccessControl(),
CacheControl = GetCacheControl()
};
IStreamingEndpoint streamingEndpoint = _context.StreamingEndpoints.Create(options);
streamingEndpoint.Start();
return streamingEndpoint;
}
private static StreamingEndpointAccessControl GetAccessControl()
{
return new StreamingEndpointAccessControl
{
IPAllowList = new List<iprange>
{
new IPRange
{
Name = "Allow all",
Address = IPAddress.Parse("0.0.0.0"),
SubnetPrefixLength = 0
}
},
AkamaiSignatureHeaderAuthenticationKeyList = new List<akamaisignatureheaderauthenticationkey>
{
new AkamaiSignatureHeaderAuthenticationKey
{
Identifier = "My key",
Expiration = DateTime.UtcNow + TimeSpan.FromDays(365),
Base64Key = Convert.ToBase64String(GenerateRandomBytes(16))
}
}
};
}
private static byte[] GenerateRandomBytes(int length)
{
var bytes = new byte[length];
using (var rng = new RNGCryptoServiceProvider())
{
rng.GetBytes(bytes);
}
return bytes;
}
private static StreamingEndpointCacheControl GetCacheControl()
{
return new StreamingEndpointCacheControl
{
MaxAge = TimeSpan.FromSeconds(1000)
};
}
public static void UpdateCrossSiteAccessPoliciesForStreamingEndpoint(IStreamingEndpoint streamingEndpoint)
{
var clientPolicy =
@"<?xml version=""1.0"" encoding=""utf-8""?>
<policy>
<domain uri=""></domain>
<resource path=""></resource>"" include-subpaths=""true""/>
</policy>
";
var xdomainPolicy =
@"<?xml version=""1.0"" ?>
";
streamingEndpoint.CrossSiteAccessPolicies.ClientAccessPolicy = clientPolicy;
streamingEndpoint.CrossSiteAccessPolicies.CrossDomainPolicy = xdomainPolicy;
streamingEndpoint.Update();
}
public static void GetLocatorsInAllStreamingEndpoints(IAsset asset)
{
var locators = asset.Locators.Where(l => l.Type == LocatorType.OnDemandOrigin);
var ismFile = asset.AssetFiles.AsEnumerable().FirstOrDefault(a => a.Name.EndsWith(".ism"));
var template = new UriTemplate("{contentAccessComponent}/{ismFileName}/manifest");
var urls = locators.SelectMany(l =>
_context
.StreamingEndpoints
.AsEnumerable()
.Where(se => se.State == StreamingEndpointState.Running)
.Select(
se =>
template.BindByPosition(new Uri("http://" + se.HostName),
l.ContentAccessComponent,
ismFile.Name)))
.ToArray();
}
public static void Cleanup(IStreamingEndpoint streamingEndpoint,
IChannel channel)
{
if (streamingEndpoint != null)
{
streamingEndpoint.Stop();
streamingEndpoint.Delete();
}
IAsset asset;
if (channel != null)
{
foreach (var program in channel.Programs)
{
asset = _context.Assets.Where(se => se.Id == program.AssetId)
.FirstOrDefault();
program.Stop();
program.Delete();
if (asset != null)
{
foreach (var l in asset.Locators)
l.Delete();
asset.Delete();
}
}
channel.Stop();
channel.Delete();
}
}
}
}
</akamaisignatureheaderauthenticationkey></iprange></iprange></iprange>Now I want to make a method to cut a live stream for example every 15 minutes and save it as mp4 but don’t know where to start.
Can someone point me in the right direction ?
Kind regards
UPDATE :
I want to save the mp4 files on my hard disk.
-
OpenCV VideoWriter using ffmpeg with "Could not open codec 'libx264'" Error
19 avril, par user2262504I am new to OpenCV, and I want write Mat images into video using VideoWriter on Ubuntu 12.04. But when constructing VideoWriter, errors came out.



It seems that OpenCV invoke ffmpeg API using default parameters and ffmpeg invoke x264 using its default parameters. Then these setting is broken for libx264. Thus the "Could not open codec 'libx264'" error.



Anyone has ideas to solve this problem ?



More specifically :



- 

- anyone knows where and how OpenCV invoke ffmpeg API ?
- how to change ffmpeg default settings using code, hopefull, can be easily embeded into OpenCV ?
- will changes of default in ffmpeg be carried to libx264 ?









Errors :



1. Uising CV_FOURCC('H', '2', '6', '4')
[libx264 @ 0x255de40] broken ffmpeg default settings detected
[libx264 @ 0x255de40] use an encoding preset (e.g. -vpre medium)
[libx264 @ 0x255de40] preset usage: -vpre <speed> -vpre <profile>
[libx264 @ 0x255de40] speed presets are listed in x264 --help
[libx264 @ 0x255de40] profile is optional; x264 defaults to high
Could not open codec 'libx264': Unspecified error

2. Using FOURCC = -1 to invoke user customized codec
OpenCV Error: Unsupported format or combination of formats (Gstreamer Opencv 
backend doesn't support this codec acutally.) in CvVideoWriter_GStreamer::open, 
file /home/XXX/Downloads/opencv-2.4.8/modules/highgui/src/cap_gstreamer.cpp, 
line 505 terminate called after throwing an instance of 'cv::Exception'
what(): /home/XXX/Downloads/opencv-2.4.8/modules/highgui/src/cap_gstreamer.cpp:
505: error: (-210) Gstreamer Opencv backend doesn't support this codec acutally.
in function CvVideoWriter_GStreamer::open
</profile></speed>



Codes :



int main(int argc, char *argv[])
{
 VideoWriter outputVideo;
 bool fourcc_on = true; //switch on / off different error
 if (fourcc_on)
 outputVideo.open("outVideo.avi", CV_FOURCC('H', '2', '6', '4'), 25, Size(100, 100), true);
 else
 outputVideo.open("outVideo.avi", -1, 25, Size(100, 100), true);

 if (!outputVideo.isOpened())
 {
 cout << "Could not open the output video for write" << endl;
 return -1;
 }
 return 0;
}




OpenCV Configuration :



-- Detected version of GNU GCC: 46 (406)
-- Found OpenEXR: /usr/lib/libIlmImf.so
-- Looking for linux/videodev.h
-- Looking for linux/videodev.h - not found
-- Looking for linux/videodev2.h
-- Looking for linux/videodev2.h - found
-- Looking for sys/videoio.h
-- Looking for sys/videoio.h - not found
-- Looking for libavformat/avformat.h
-- Looking for libavformat/avformat.h - found
-- Looking for ffmpeg/avformat.h
-- Looking for ffmpeg/avformat.h - not found
-- Could NOT find JNI (missing: JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH) 
-- 
-- General configuration for OpenCV 2.4.8 =====================================
-- Version control: unknown
-- 
-- Platform:
-- Host: Linux 3.8.0-38-generic x86_64
-- CMake: 2.8.7
-- CMake generator: Unix Makefiles
-- CMake build tool: /usr/bin/make
-- Configuration: RELEASE
-- 
-- C/C++:
-- Built as dynamic libs?: YES
-- C++ Compiler: /usr/bin/c++ (ver 4.6)
-- C++ flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -msse3 -ffunction-sections -O3 -DNDEBUG -DNDEBUG
-- C++ flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -msse3 -ffunction-sections -g -O0 -DDEBUG -D_DEBUG
-- C Compiler: /usr/bin/gcc
-- C flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -msse3 -ffunction-sections -O3 -DNDEBUG -DNDEBUG
-- C flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -msse3 -ffunction-sections -g -O0 -DDEBUG -D_DEBUG
-- Linker flags (Release): 
-- Linker flags (Debug): 
-- Precompiled headers: YES
-- 
-- OpenCV modules:
-- To be built: core flann imgproc highgui features2d calib3d ml video legacy objdetect photo gpu ocl nonfree contrib python stitching superres ts videostab
-- Disabled: world
-- Disabled by dependency: -
-- Unavailable: androidcamera dynamicuda java
-- 
-- GUI: 
-- QT: NO
-- GTK+ 2.x: YES (ver 2.24.10)
-- GThread : YES (ver 2.32.4)
-- GtkGlExt: NO
-- OpenGL support: NO
-- 
-- Media I/O: 
-- ZLib: /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.3.4)
-- JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (ver )
-- PNG: /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.2.46)
-- TIFF: /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 - 3.9.5)
-- JPEG 2000: /usr/lib/x86_64-linux-gnu/libjasper.so (ver 1.900.1)
-- OpenEXR: /usr/lib/libImath.so /usr/lib/libIlmImf.so /usr/lib/libIex.so /usr/lib/libHalf.so /usr/lib/libIlmThread.so (ver 1.6.1)
-- 
-- Video I/O:
-- DC1394 1.x: NO
-- DC1394 2.x: YES (ver 2.2.0)
-- FFMPEG: YES
-- codec: YES (ver 55.58.105)
-- format: YES (ver 55.37.101)
-- util: YES (ver 52.78.100)
-- swscale: YES (ver 2.6.100)
-- gentoo-style: YES
-- GStreamer: 
-- base: YES (ver 0.10.36)
-- app: YES (ver 0.10.36)
-- video: YES (ver 0.10.36)
-- OpenNI: NO
-- OpenNI PrimeSensor Modules: NO
-- PvAPI: NO
-- GigEVisionSDK: NO
-- UniCap: NO
-- UniCap ucil: NO
-- V4L/V4L2: Using libv4l (ver 1.0.1)
-- XIMEA: NO
-- Xine: NO
-- 
-- Other third-party libraries:
-- Use IPP: NO
-- Use Eigen: NO
-- Use TBB: NO
-- Use OpenMP: NO
-- Use GCD NO
-- Use Concurrency NO
-- Use C=: NO
-- Use Cuda: NO
-- Use OpenCL: YES
-- 
-- OpenCL:
-- Version: dynamic
-- Include path: /home/shixudongleo/Downloads/opencv-2.4.8/3rdparty/include/opencl/1.2
-- Use AMD FFT: NO
-- Use AMD BLAS: NO
-- 
-- Python:
-- Interpreter: /usr/bin/python (ver 2.7.3)
-- Libraries: /usr/lib/libpython2.7.so
-- numpy: /usr/lib/python2.7/dist-packages/numpy/core/include (ver 1.6.1)
-- packages path: lib/python2.7/dist-packages
-- 
-- Java:
-- ant: NO
-- JNI: NO
-- Java tests: NO
-- 
-- Documentation:
-- Build Documentation: NO
-- Sphinx: NO
-- PdfLaTeX compiler: /usr/bin/pdflatex
-- 
-- Tests and samples:
-- Tests: YES
-- Performance tests: YES
-- C/C++ Examples: NO
-- 
-- Install path: /usr/local
-- 
-- cvconfig.h is in: /home/shixudongleo/Downloads/opencv-2.4.8/build
-- -----------------------------------------------------------------
-- 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/XXX/Downloads/opencv-2.4.8/build




FFMPEG



ffmpeg is enable to support OpenCV and libx264 is enabled when compiling ffmpeg.
By using ffmpeg command line, libx264 is running normally.



$ ffmpeg -i test.avi -vcodec libx264 test.mp4
ffmpeg -i test.avi -vcodec libx264 test.mp4 > ~/Downloads/ffmpeg_log.txt
ffmpeg version 2.2.git Copyright (c) 2000-2014 the FFmpeg developers
 built on Apr 24 2014 16:39:51 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
 configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-nonfree --enable-postproc --enable-version3 --enable-x11grab --enable-shared --enable-pic
 libavutil 52. 78.100 / 52. 78.100
 libavcodec 55. 58.105 / 55. 58.105
 libavformat 55. 37.101 / 55. 37.101
 libavdevice 55. 13.100 / 55. 13.100
 libavfilter 4. 4.100 / 4. 4.100
 libswscale 2. 6.100 / 2. 6.100
 libswresample 0. 18.100 / 0. 18.100
 libpostproc 52. 3.100 / 52. 3.100
Input #0, avi, from 'test.avi':
 Duration: 00:00:03.73, start: 0.000000, bitrate: 1757 kb/s
 Stream #0:0: Video: msvideo1 (CRAM / 0x4D415243), rgb555le, 320x240, 1781 kb/s, 15 tbr, 15 tbn, 15 tbc
 Metadata:
 title : julius.avi Video #1
File 'test.mp4' already exists. Overwrite ? [y/N] y
No pixel format specified, yuv444p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 0x25d08e0] using cpu capabilities: none!
[libx264 @ 0x25d08e0] profile High 4:4:4 Predictive, level 1.2, 4:4:4 8-bit
[libx264 @ 0x25d08e0] 264 - core 142 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=4 threads=12 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=15 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'test.mp4':
 Metadata:
 encoder : Lavf55.37.101
 Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv444p, 320x240, q=-1--1, 15360 tbn, 15 tbc
 Metadata:
 title : julius.avi Video #1
Stream mapping:
 Stream #0:0 -> #0:0 (msvideo1 -> libx264)
Press [q] to stop, [?] for help
frame= 56 fps=0.0 q=-1.0 Lsize= 321kB time=00:00:03.60 bitrate= 731.0kbits/s 
video:320kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.409949%
[libx264 @ 0x25d08e0] frame I:3 Avg QP:15.36 size: 7975
[libx264 @ 0x25d08e0] frame P:38 Avg QP:26.05 size: 6230
[libx264 @ 0x25d08e0] frame B:15 Avg QP:28.25 size: 4418
[libx264 @ 0x25d08e0] consecutive B-frames: 46.4% 53.6% 0.0% 0.0%
[libx264 @ 0x25d08e0] mb I I16..4: 1.4% 72.8% 25.8%
[libx264 @ 0x25d08e0] mb P I16..4: 1.6% 5.7% 15.1% P16..4: 7.6% 6.3% 7.4% 0.0% 0.0% skip:56.3%
[libx264 @ 0x25d08e0] mb B I16..4: 0.2% 1.0% 2.0% B16..8: 13.3% 7.8% 8.7% direct: 8.3% skip:58.8% L0:34.9% L1:36.6% BI:28.5%
[libx264 @ 0x25d08e0] 8x8 transform intra:37.7% inter:2.3%
[libx264 @ 0x25d08e0] coded y,u,v intra: 52.1% 42.1% 30.1% inter: 19.6% 9.2% 5.2%
[libx264 @ 0x25d08e0] i16 v,h,dc,p: 56% 17% 24% 2%
[libx264 @ 0x25d08e0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 10% 16% 68% 1% 1% 1% 1% 1% 1%
[libx264 @ 0x25d08e0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19% 18% 28% 5% 6% 5% 7% 5% 6%
[libx264 @ 0x25d08e0] Weighted P-Frames: Y:31.6% UV:21.1%
[libx264 @ 0x25d08e0] ref P L0: 70.5% 9.0% 12.1% 6.5% 2.0%
[libx264 @ 0x25d08e0] ref B L0: 91.3% 8.7%
[libx264 @ 0x25d08e0] kb/s:700.56



-
Quick stream from file which exists
4 mai 2017, par parsaI implement live streaming from mp4 video file which exists on the path with ffmpeg under hls format.
When my video file have the quality greater than hd720 , in encoding there are so many delays for creating .ts fragments.
I mean the .ts fragments slowly produced on my path,and because of it I have so many delays in showing the stream.
Here is my ffmpeg code for streaming :ffmpeg -re -i 123.mp4 -s cga -f hls -hls_list_size 0 -c:v libx264 -c:a aac 200p/out.m3u8
-s nhd -f hls -hls_list_size 0 -c:v libx264 -c:a aac 360p/out.m3u8
-s hd480 -f hls -hls_list_size 0 -c:v libx264 -c:a aac 480p/out.m3u8
-s hd720 -f hls -hls_list_size 0 -c:v libx264 -c:a aac 720p/out.m3u8
-s hd1080 -f hls -hls_list_size 0 -c:v libx264 -c:a aac 1080p/out.m3u8And here is the console output :
ffmpeg -re -i ../files/412-887123464/video/412-887123464.mp4 -s cga -f hls -hls_list_size 0 -c:v libx264 -c:a aac ../fil
es/412-887123464/video/200p/out.m3u8 -s nhd -f hls -hls_list_size 0 -c:v libx264 -c:a aac ../files/412-887123464/video/360p/out.m3u8 -s hd480 -f hls -
hls_list_size 0 -c:v libx264 -c:a aac ../files/412-887123464/video/480p/out.m3u8 -s hd720 -f hls -hls_list_size 0 -c:v libx264 -c:a aac ../files/412-88
7123464/video/720p/out.m3u8 -s hd1080 -f hls -hls_list_size 0 -c:v libx264 -c:a aac ../files/412-887123464/video/1080p/out.m3u8
ffmpeg version N-82225-gb4e9252 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 5.4.0 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --e
nable-libebur128 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcac
a --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-lib
opencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr
--enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwa
vpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zl
ib
libavutil 55. 35.100 / 55. 35.100
libavcodec 57. 66.101 / 57. 66.101
libavformat 57. 57.100 / 57. 57.100
libavdevice 57. 2.100 / 57. 2.100
libavfilter 6. 66.100 / 6. 66.100
libswscale 4. 3.100 / 4. 3.100
libswresample 2. 4.100 / 2. 4.100
libpostproc 54. 2.100 / 54. 2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '../files/412-887123464/video/412-887123464.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.31.100
Duration: 00:05:04.07, start: 0.000000, bitrate: 3108 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 2976 kb/s, 25 fps, 25 tbr, 90k tbn, 50
tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)
Metadata:
handler_name : SoundHandler
[libx264 @ 0000000001c53f00] using SAR=10/9
[libx264 @ 0000000001c53f00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 0000000001c53f00] profile High, level 1.3
Output #0, hls, to '../files/412-887123464/video/200p/out.m3u8':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.57.100
Stream #0:0(und): Video: h264 (libx264), yuv420p, 320x200 [SAR 10:9 DAR 16:9], q=-1--1, 25 fps, 90k tbn, 25 tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Lavc57.66.101 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1(und): Audio: aac (LC), 44100 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
encoder : Lavc57.66.101 aac
[libx264 @ 0000000001f87180] using SAR=1/1
[libx264 @ 0000000001f87180] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 0000000001f87180] profile High, level 3.0
Output #1, hls, to '../files/412-887123464/video/360p/out.m3u8':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.57.100
Stream #1:0(und): Video: h264 (libx264), yuv420p, 640x360 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 90k tbn, 25 tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Lavc57.66.101 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #1:1(und): Audio: aac (LC), 44100 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
encoder : Lavc57.66.101 aac
[libx264 @ 0000000001c55ba0] using SAR=640/639
[libx264 @ 0000000001c55ba0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 0000000001c55ba0] profile High, level 3.0
Output #2, hls, to '../files/412-887123464/video/480p/out.m3u8':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.57.100
Stream #2:0(und): Video: h264 (libx264), yuv420p, 852x480 [SAR 640:639 DAR 16:9], q=-1--1, 25 fps, 90k tbn, 25 tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Lavc57.66.101 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #2:1(und): Audio: aac (LC), 44100 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
encoder : Lavc57.66.101 aac
[libx264 @ 0000000001ca0220] using SAR=1/1
[libx264 @ 0000000001ca0220] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 0000000001ca0220] profile High, level 3.1
Output #3, hls, to '../files/412-887123464/video/720p/out.m3u8':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.57.100
Stream #3:0(und): Video: h264 (libx264), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 90k tbn, 25 tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Lavc57.66.101 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #3:1(und): Audio: aac (LC), 44100 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
encoder : Lavc57.66.101 aac
[libx264 @ 0000000001ca23e0] using SAR=1/1
[libx264 @ 0000000001ca23e0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 0000000001ca23e0] profile High, level 4.0
Output #4, hls, to '../files/412-887123464/video/1080p/out.m3u8':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.57.100
Stream #4:0(und): Video: h264 (libx264), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 90k tbn, 25 tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Lavc57.66.101 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #4:1(und): Audio: aac (LC), 44100 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
encoder : Lavc57.66.101 aac
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Stream #0:0 -> #1:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #1:1 (aac (native) -> aac (native))
Stream #0:0 -> #2:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #2:1 (aac (native) -> aac (native))
Stream #0:0 -> #3:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #3:1 (aac (native) -> aac (native))
Stream #0:0 -> #4:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #4:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
frame= 7600 fps= 21 q=-1.0 Lq=-1.0 q=-1.0 q=-1.0 q=-1.0 size=N/A time=00:05:04.06 bitrate=N/A speed=0.835x
video:294980kB audio:23995kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[libx264 @ 0000000001d33f00] frame I:33 Avg QP:19.93 size: 11412
[libx264 @ 0000000001d33f00] frame P:2281 Avg QP:23.72 size: 3112
[libx264 @ 0000000001d33f00] frame B:5286 Avg QP:28.59 size: 446
[libx264 @ 0000000001d33f00] consecutive B-frames: 4.3% 6.9% 5.9% 82.8%
[libx264 @ 0000000001d33f00] mb I I16..4: 12.9% 42.9% 44.2%
[libx264 @ 0000000001d33f00] mb P I16..4: 1.3% 4.4% 2.3% P16..4: 41.4% 22.0% 15.5% 0.0% 0.0% skip:13.1%
[libx264 @ 0000000001d33f00] mb B I16..4: 0.0% 0.1% 0.0% B16..8: 35.2% 5.9% 2.1% direct: 3.0% skip:53.6% L0:35.3% L1:48.0% BI:16.8%
[libx264 @ 0000000001d33f00] 8x8 transform intra:53.4% inter:57.9%
[libx264 @ 0000000001d33f00] coded y,uvDC,uvAC intra: 70.6% 89.7% 67.6% inter: 18.1% 20.3% 7.2%
[libx264 @ 0000000001d33f00] i16 v,h,dc,p: 24% 24% 6% 45%
[libx264 @ 0000000001d33f00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 14% 19% 5% 5% 7% 5% 10% 7%
[libx264 @ 0000000001d33f00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 15% 15% 6% 6% 7% 6% 8% 6%
[libx264 @ 0000000001d33f00] i8c dc,h,v,p: 42% 17% 28% 14%
[libx264 @ 0000000001d33f00] Weighted P-Frames: Y:26.3% UV:12.9%
[libx264 @ 0000000001d33f00] ref P L0: 58.7% 24.7% 10.9% 4.8% 1.0%
[libx264 @ 0000000001d33f00] ref B L0: 92.6% 5.8% 1.6%
[libx264 @ 0000000001d33f00] ref B L1: 96.3% 3.7%
[libx264 @ 0000000001d33f00] kb/s:258.68
[aac @ 00000000005fc9e0] Qavg: 686.637
[libx264 @ 0000000002017180] frame I:31 Avg QP:19.77 size: 29228
[libx264 @ 0000000002017180] frame P:2040 Avg QP:23.08 size: 8765
[libx264 @ 0000000002017180] frame B:5529 Avg QP:27.28 size: 1471
[libx264 @ 0000000002017180] consecutive B-frames: 1.3% 4.2% 2.4% 92.1%
[libx264 @ 0000000002017180] mb I I16..4: 8.3% 58.8% 32.9%
[libx264 @ 0000000002017180] mb P I16..4: 3.2% 9.5% 2.6% P16..4: 41.5% 19.5% 11.4% 0.0% 0.0% skip:12.2%
[libx264 @ 0000000002017180] mb B I16..4: 0.2% 0.3% 0.1% B16..8: 34.5% 5.8% 1.7% direct: 2.7% skip:54.7% L0:35.9% L1:49.5% BI:14.6%
[libx264 @ 0000000002017180] 8x8 transform intra:61.2% inter:67.3%
[libx264 @ 0000000002017180] coded y,uvDC,uvAC intra: 55.8% 84.8% 51.3% inter: 15.6% 19.3% 3.9%
[libx264 @ 0000000002017180] i16 v,h,dc,p: 24% 29% 8% 39%
[libx264 @ 0000000002017180] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 17% 21% 5% 5% 7% 5% 8% 6%
[libx264 @ 0000000002017180] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 18% 15% 6% 7% 7% 6% 7% 5%
[libx264 @ 0000000002017180] i8c dc,h,v,p: 42% 18% 27% 13%
[libx264 @ 0000000002017180] Weighted P-Frames: Y:22.3% UV:12.2%
[libx264 @ 0000000002017180] ref P L0: 58.5% 23.4% 12.2% 5.2% 0.8%
[libx264 @ 0000000002017180] ref B L0: 93.1% 5.3% 1.6%
[libx264 @ 0000000002017180] ref B L1: 96.6% 3.4%
[libx264 @ 0000000002017180] kb/s:708.47
[aac @ 0000000001d35200] Qavg: 686.637
[libx264 @ 0000000001d35ba0] frame I:31 Avg QP:19.63 size: 41522
[libx264 @ 0000000001d35ba0] frame P:2025 Avg QP:22.86 size: 13415
[libx264 @ 0000000001d35ba0] frame B:5544 Avg QP:26.52 size: 2471
[libx264 @ 0000000001d35ba0] consecutive B-frames: 1.1% 3.9% 2.8% 92.2%
[libx264 @ 0000000001d35ba0] mb I I16..4: 10.6% 62.4% 26.9%
[libx264 @ 0000000001d35ba0] mb P I16..4: 4.7% 12.4% 2.6% P16..4: 41.1% 17.8% 9.4% 0.0% 0.0% skip:11.9%
[libx264 @ 0000000001d35ba0] mb B I16..4: 0.3% 0.5% 0.1% B16..8: 34.0% 5.5% 1.4% direct: 2.9% skip:55.3% L0:36.7% L1:50.2% BI:13.1%
[libx264 @ 0000000001d35ba0] 8x8 transform intra:61.7% inter:71.6%
[libx264 @ 0000000001d35ba0] coded y,uvDC,uvAC intra: 48.0% 81.9% 43.3% inter: 14.7% 19.7% 2.6%
[libx264 @ 0000000001d35ba0] i16 v,h,dc,p: 27% 29% 9% 35%
[libx264 @ 0000000001d35ba0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 19% 22% 5% 5% 6% 5% 7% 5%
[libx264 @ 0000000001d35ba0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 26% 25% 16% 5% 6% 7% 6% 6% 4%
[libx264 @ 0000000001d35ba0] i8c dc,h,v,p: 42% 20% 26% 12%
[libx264 @ 0000000001d35ba0] Weighted P-Frames: Y:18.1% UV:10.8%
[libx264 @ 0000000001d35ba0] ref P L0: 59.5% 22.6% 12.6% 4.8% 0.5%
[libx264 @ 0000000001d35ba0] ref B L0: 93.6% 5.0% 1.4%
[libx264 @ 0000000001d35ba0] ref B L1: 97.1% 2.9%
[libx264 @ 0000000001d35ba0] kb/s:1109.23
[aac @ 0000000001d828a0] Qavg: 686.637
[libx264 @ 0000000001d7f880] frame I:32 Avg QP:19.45 size: 64737
[libx264 @ 0000000001d7f880] frame P:2104 Avg QP:22.44 size: 23985
[libx264 @ 0000000001d7f880] frame B:5464 Avg QP:25.65 size: 4999
[libx264 @ 0000000001d7f880] consecutive B-frames: 1.2% 7.7% 3.2% 87.8%
[libx264 @ 0000000001d7f880] mb I I16..4: 12.5% 70.0% 17.5%
[libx264 @ 0000000001d7f880] mb P I16..4: 6.7% 17.1% 1.8% P16..4: 40.7% 14.9% 6.6% 0.0% 0.0% skip:12.2%
[libx264 @ 0000000001d7f880] mb B I16..4: 0.6% 0.9% 0.1% B16..8: 32.5% 4.7% 1.0% direct: 2.9% skip:57.4% L0:37.6% L1:51.6% BI:10.8%
[libx264 @ 0000000001d7f880] 8x8 transform intra:65.7% inter:77.5%
[libx264 @ 0000000001d7f880] coded y,uvDC,uvAC intra: 39.5% 76.4% 32.4% inter: 13.2% 19.8% 1.5%
[libx264 @ 0000000001d7f880] i16 v,h,dc,p: 32% 27% 10% 31%
[libx264 @ 0000000001d7f880] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 30% 18% 23% 4% 5% 5% 4% 5% 4%
[libx264 @ 0000000001d7f880] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 20% 15% 5% 7% 7% 6% 6% 4%
[libx264 @ 0000000001d7f880] i8c dc,h,v,p: 42% 19% 27% 12%
[libx264 @ 0000000001d7f880] Weighted P-Frames: Y:10.5% UV:6.7%
[libx264 @ 0000000001d7f880] ref P L0: 62.3% 20.4% 12.7% 4.3% 0.3%
[libx264 @ 0000000001d7f880] ref B L0: 93.4% 5.2% 1.4%
[libx264 @ 0000000001d7f880] ref B L1: 97.7% 2.3%
[libx264 @ 0000000001d7f880] kb/s:2101.26
[aac @ 0000000001d81560] Qavg: 686.637
[libx264 @ 0000000001d7fd60] frame I:33 Avg QP:18.36 size: 98904
[libx264 @ 0000000001d7fd60] frame P:3180 Avg QP:21.67 size: 33377
[libx264 @ 0000000001d7fd60] frame B:4387 Avg QP:24.61 size: 7729
[libx264 @ 0000000001d7fd60] consecutive B-frames: 2.7% 55.9% 15.6% 25.9%
[libx264 @ 0000000001d7fd60] mb I I16..4: 22.4% 66.9% 10.7%
[libx264 @ 0000000001d7fd60] mb P I16..4: 9.9% 17.8% 0.7% P16..4: 40.4% 9.2% 3.0% 0.0% 0.0% skip:19.0%
[libx264 @ 0000000001d7fd60] mb B I16..4: 0.8% 1.3% 0.1% B16..8: 30.2% 2.6% 0.4% direct: 1.7% skip:63.0% L0:38.1% L1:54.9% BI: 7.0%
[libx264 @ 0000000001d7fd60] 8x8 transform intra:62.5% inter:82.9%
[libx264 @ 0000000001d7fd60] coded y,uvDC,uvAC intra: 25.4% 59.5% 11.6% inter: 9.6% 16.3% 0.7%
[libx264 @ 0000000001d7fd60] i16 v,h,dc,p: 33% 28% 15% 24%
[libx264 @ 0000000001d7fd60] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 34% 20% 29% 3% 3% 4% 3% 3% 3%
[libx264 @ 0000000001d7fd60] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 30% 25% 16% 4% 6% 6% 5% 5% 4%
[libx264 @ 0000000001d7fd60] i8c dc,h,v,p: 39% 21% 28% 12%
[libx264 @ 0000000001d7fd60] Weighted P-Frames: Y:5.7% UV:3.6%
[libx264 @ 0000000001d7fd60] ref P L0: 70.0% 18.6% 8.3% 3.1% 0.1%
[libx264 @ 0000000001d7fd60] ref B L0: 91.4% 7.6% 1.0%
[libx264 @ 0000000001d7fd60] ref B L1: 99.0% 1.0%
[libx264 @ 0000000001d7fd60] kb/s:3771.31
[aac @ 0000000001d823e0] Qavg: 686.637But I don’t have any problem for streaming files with creating resolutions from a file which have lower orginal quality than hd1080
What I can to do ?