
Recherche avancée
Médias (1)
-
La conservation du net art au musée. Les stratégies à l’œuvre
26 mai 2011
Mis à jour : Juillet 2013
Langue : français
Type : Texte
Autres articles (72)
-
Le profil des utilisateurs
12 avril 2011, parChaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...) -
Configurer la prise en compte des langues
15 novembre 2010, parAccéder à la configuration et ajouter des langues prises en compte
Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...) -
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir
Sur d’autres sites (8823)
-
Decrypting fragmented mpeg-dash using ffmpeg
6 octobre 2022, par Sayem Prodhan AnantaI have an mpeg-dash which I want to decrypt. I have the CENC decryption key. But I am unable to get it working. The dash uses segment template. Here is the dash


<?xml version="1.0" ?>
<mpd mediapresentationduration="PT1H55M53.987S" minbuffertime="PT6.00S" profiles="urn:mpeg:dash:profile:isoff-live:2011" type="static" xmlns="urn:mpeg:dash:schema:mpd:2011">
 
 <period>
 
 <adaptationset maxheight="720" maxwidth="1280" mimetype="video/mp4" segmentalignment="true" startwithsap="1">
 <accessibility schemeiduri="urn:scte:dash:cc:cea-608:2015" value="eng"></accessibility>
 <viewpoint schemeiduri="urn:mpeg:dash:role:2011" value="vp2"></viewpoint>
 
 <contentprotection schemeiduri="urn:mpeg:dash:mp4protection:2011" value="cenc"></contentprotection>
 
 <contentprotection schemeiduri="urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95">
 pAIAAAEAAQCaAjwAVwBSAE0ASABFAEEARABFAFIAIAB4AG0AbABuAHMAPQAiAGgAdAB0AHAAOgAvAC8AcwBjAGgAZQBtAGEAcwAuAG0AaQBjAHIAbwBzAG8AZgB0AC4AYwBvAG0ALwBEAFIATQAvADIAMAAwADcALwAwADMALwBQAGwAYQB5AFIAZQBhAGQAeQBIAGUAYQBkAGUAcgAiACAAdgBlAHIAcwBpAG8AbgA9ACIANAAuADAALgAwAC4AMAAiAD4APABEAEEAVABBAD4APABQAFIATwBUAEUAQwBUAEkATgBGAE8APgA8AEsARQBZAEwARQBOAD4AMQA2ADwALwBLAEUAWQBMAEUATgA+ADwAQQBMAEcASQBEAD4AQQBFAFMAQwBUAFIAPAAvAEEATABHAEkARAA+ADwALwBQAFIATwBUAEUAQwBUAEkATgBGAE8APgA8AEsASQBEAD4AOABoAFcAMwBQAEsAeABPAEkAYwB1AGsAVwBWAHgASwBaAHgAMgA3AEMAZwA9AD0APAAvAEsASQBEAD4APABDAEgARQBDAEsAUwBVAE0APgBBAGQARgAvAFEAcwBzAHEATQBhAEEAPQA8AC8AQwBIAEUAQwBLAFMAVQBNAD4APABMAEEAXwBVAFIATAA+AGgAdAB0AHAAOgAvAC8AcAByAC4AcwBlAHIAdgBpAGMAZQAuAGUAeABwAHIAZQBzAHMAcABsAGEAeQAuAGMAbwBtAC8AcABsAGEAeQByAGUAYQBkAHkALwBSAGkAZwBoAHQAcwBNAGEAbgBhAGcAZQByAC4AYQBzAG0AeAA8AC8ATABBAF8AVQBSAEwAPgA8AC8ARABBAFQAQQA+ADwALwBXAFIATQBIAEUAQQBEAEUAUgA+AA==
 </contentprotection>
 
 <contentprotection schemeiduri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed">
 AAAAQ3Bzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAACMIARIQPLcV8k6syyGkWVxKZx27ChoKaW50ZXJ0cnVzdCIBKg==
 </contentprotection>
 <segmenttemplate duration="6000" initialization="$RepresentationID$/init.mp4" media="$RepresentationID$/seg-$Number$.m4s" startnumber="1" timescale="1000"></segmenttemplate>
 <representation bandwidth="634478" codecs="avc1.4D401F" framerate="2997/100" height="288" scantype="progressive" width="512"></representation>
 <representation bandwidth="789637" codecs="avc1.4D401F" framerate="2997/100" height="360" scantype="progressive" width="640"></representation>
 <representation bandwidth="1562569" codecs="avc1.4D401F" framerate="2997/100" height="432" scantype="progressive" width="768"></representation>
 <representation bandwidth="2124583" codecs="avc1.4D401F" framerate="2997/100" height="720" scantype="progressive" width="1280"></representation>
 </adaptationset>
 
 <adaptationset lang="en" mimetype="audio/mp4" segmentalignment="true" startwithsap="1">
 
 <contentprotection schemeiduri="urn:mpeg:dash:mp4protection:2011" value="cenc"></contentprotection>
 
 <contentprotection schemeiduri="urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95">
 pAIAAAEAAQCaAjwAVwBSAE0ASABFAEEARABFAFIAIAB4AG0AbABuAHMAPQAiAGgAdAB0AHAAOgAvAC8AcwBjAGgAZQBtAGEAcwAuAG0AaQBjAHIAbwBzAG8AZgB0AC4AYwBvAG0ALwBEAFIATQAvADIAMAAwADcALwAwADMALwBQAGwAYQB5AFIAZQBhAGQAeQBIAGUAYQBkAGUAcgAiACAAdgBlAHIAcwBpAG8AbgA9ACIANAAuADAALgAwAC4AMAAiAD4APABEAEEAVABBAD4APABQAFIATwBUAEUAQwBUAEkATgBGAE8APgA8AEsARQBZAEwARQBOAD4AMQA2ADwALwBLAEUAWQBMAEUATgA+ADwAQQBMAEcASQBEAD4AQQBFAFMAQwBUAFIAPAAvAEEATABHAEkARAA+ADwALwBQAFIATwBUAEUAQwBUAEkATgBGAE8APgA8AEsASQBEAD4AOABoAFcAMwBQAEsAeABPAEkAYwB1AGsAVwBWAHgASwBaAHgAMgA3AEMAZwA9AD0APAAvAEsASQBEAD4APABDAEgARQBDAEsAUwBVAE0APgBBAGQARgAvAFEAcwBzAHEATQBhAEEAPQA8AC8AQwBIAEUAQwBLAFMAVQBNAD4APABMAEEAXwBVAFIATAA+AGgAdAB0AHAAOgAvAC8AcAByAC4AcwBlAHIAdgBpAGMAZQAuAGUAeABwAHIAZQBzAHMAcABsAGEAeQAuAGMAbwBtAC8AcABsAGEAeQByAGUAYQBkAHkALwBSAGkAZwBoAHQAcwBNAGEAbgBhAGcAZQByAC4AYQBzAG0AeAA8AC8ATABBAF8AVQBSAEwAPgA8AC8ARABBAFQAQQA+ADwALwBXAFIATQBIAEUAQQBEAEUAUgA+AA==
 </contentprotection>
 
 <contentprotection schemeiduri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed">
 AAAAQ3Bzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAACMIARIQPLcV8k6syyGkWVxKZx27ChoKaW50ZXJ0cnVzdCIBKg==
 </contentprotection>
 <segmenttemplate duration="6000" initialization="$RepresentationID$/init.mp4" media="$RepresentationID$/seg-$Number$.m4s" startnumber="1" timescale="1000"></segmenttemplate>
 <representation audiosamplingrate="48000" bandwidth="136225" codecs="mp4a.40.2">
 <audiochannelconfiguration schemeiduri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"></audiochannelconfiguration>
 </representation>
 </adaptationset>
 </period>
</mpd>



I have produced an mp4 file by combining all the segments like this


init.mp4+seg-1.m4s+seg-2.m4s+....+seg-1159.m4s



But I end up with following error


ffmpeg version N-99631-g9018257751-anan5a-2020-10-19 Copyright (c) 2000-2020 the FFmpeg developers
 built with gcc 8 (Debian 8.3.0-6)
 configuration: --extra-version=anan5a-2020-10-19 --enable-gpl --enable-version3 --disable-shared --enable-static --enable-small --enable-avisynth --enable-chromaprint --enable-frei0r --enable-gmp --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-librtmp --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtesseract --enable-libtheora --enable-libtwolame --enable-libv4l2 --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libxml2 --enable-libzmq --enable-libzvbi --enable-lv2 --enable-openal --enable-opencl --enable-opengl --enable-libdrm --enable-nonfree --enable-libfdk-aac --enable-libbluray --enable-libzimg --enable-libsvtav1
 libavutil 56. 60.100 / 56. 60.100
 libavcodec 58.111.101 / 58.111.101
 libavformat 58. 62.100 / 58. 62.100
 libavdevice 58. 11.102 / 58. 11.102
 libavfilter 7. 87.100 / 7. 87.100
 libswscale 5. 8.100 / 5. 8.100
 libswresample 3. 8.100 / 3. 8.100
 libpostproc 55. 8.100 / 55. 8.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x557789b49300] Incorrect number of samples in encryption info
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x557789b49300] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none, 512x288, 616 kb/s): unspecified pixel format
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '../videos/enc.0a7bd4e9ec72b6e0-5549.mkv':
 Metadata:
 major_brand : isom
 minor_version : 512
 compatible_brands: isomiso2avc1mp41iso5iso6
 Duration: 01:55:47.95, bitrate: 625 kb/s
 Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), none, 512x288, 616 kb/s, SAR 1:1 DAR 16:9, 29.97 fps, 11988 tbr, 11988 tbn, 23976 tbc (default)
 Metadata:
 handler_name : Bento4 Video Handler
 Side data:
 unknown side data type 24 (779 bytes)
Output #0, matroska, to '../videos/dec.0a7bd4e9ec72b6e0-5549.mkv':
 Metadata:
 major_brand : isom
 minor_version : 512
 compatible_brands: isomiso2avc1mp41iso5iso6
 encoder : Lavf58.62.100
 Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), none, 512x288 [SAR 1:1 DAR 16:9], q=2-31, 616 kb/s, 29.97 fps, 11988 tbr, 1k tbn, 11988 tbc (default)
 Metadata:
 handler_name : Bento4 Video Handler
 Side data:
 unknown side data type 24 (779 bytes)
Stream mapping:
 Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x557789b49300] Incorrect number of samples in encryption info
../videos/enc.0a7bd4e9ec72b6e0-5549.mkv: Invalid data found when processing input
frame= 0 fps=0.0 q=-1.0 Lsize= 1kB time=00:00:00.00 bitrate=N/A speed= 0x 
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown



How can I achieve the decryption without error ??


-
How to increase engagement and convert them into customers
8 septembre 2020, par Joselyn Khor — Analytics Tips, MarketingLong gone are the days of simply tracking page views as a measure of engagement. Now it’s about engagement analysis, which is layered and provides insight for effective data-driven decisions.
Discover how engaged people are with your website by uncovering behavioural patterns that tell you how well your site and content is or isn’t performing. This insight helps you re-evaluate, adapt and optimise your content and strategy. The more engaged they are, the more likely you’ll be able to guide them on a predetermined journey that results in more conversions ; and helps you reach the goals you’ve set for your business.
Why is visitor engagement important ?
It’s vital to measure engagement if you have anything content related that plays a role in your customer’s journey. Some websites may find more value in figuring out how engaging their entire site is, while others may only want to zone in on, say, a blogging section, e-newsletters, social media channels or sign-up pages.
In the larger scheme of things, engagement can be seen as what’s running your site. Every aspect of the buyer’s journey requires your visitors to be engaged. Whether you’re trying to attract, convert or build a loyal audience base, you need to know your content is optimised to maintain their attention and encourage them along the path to purchase, conversion or loyalty.
How to increase engagement with Matomo
You need to know what’s going right or wrong to eventually be able to deliver more riveting content your visitors can’t help but be drawn to. Learn how to apply Matomo’s easy-to-use features to increase engagement :
- The Behaviour feature
- Heatmaps
- A/B Testing
- Media Analytics
- Transitions
- Custom reports
- Other metrics to keep an eye on
1. Look at the Behaviour feature
It allows you to learn how visitors are responding to your content. This information is gathered by drawing insight from features such as site search, downloads, events and content interactions. Learn more
Matomo’s top five ways to increase engagement with the Behaviour feature :
Behaviour -> Pages
Get complete insights on what pages your users engage with, what pages provide little value to your business and see the results of entry and exit pages. If important content is generating low traffic, you need to place it where it can be seen. Spend time where it matters and focus on the content that will engage with your users and see how it eventually converts them into customers.Behaviour -> Site search
Site search tracks how people use your website’s internal search engine. You can see :- What search keywords visitors used on your website’s internal search.
- Which of those keywords resulted in no results (what content your visitors are looking for but cannot find).
- What pages visitors visited immediately after a search.
- What search categories visitors use (if your website employs search categories).
Behaviour -> Downloads
What are users wanting to take away with them ? They could be downloading .pdfs, .zip files, ebooks, infographics or other free/paid resources. For example, if you were working for an education institution and created valuable information packs for students that you made available online in .pdf format. To see an increase in downloads meant students were finding the .pdfs and realising the need to download them. No downloads could mean the information packs weren’t being found which would be problematic.Behaviour -> Events
Tracking events is a very useful way to measure the interactions your users have with your website content, which are not directly page views or downloads.How have Events been used effectively ? A great example comes from one of our customers, Catalyst. They wanted to capture and measure the user interaction of accordions (an area of content that expands or closes depending on how a user interacts with it) to see if people were actually getting all the information available to them on this one page. By creating an Event to record which accordion had been opened, as well as creating events for other user interactions, they were able to figure out which content got the most engagement and which got the least. Being able to see how visitors navigated through their website helped them optimise the site to ensure people were getting the relevant information they were craving.
Behaviour -> Content interactions
Content tracking allows you to track interaction within the content of your web page. Go beyond page views, bounce rates and average time spent on page with your content. Instead, you can analyse content interaction rates based on mouse clicking and configuring scrolling or hovering behaviours to see precisely how engaged your users are. If interaction rates are low, perhaps you need to restructure your page layout to grab your user’s attention sooner. Possibly you will get more interaction when you have more images or banner ads to other areas of your business.Watch this video to learn about the Behaviour feature
2. Set up Heatmaps
Effortlessly discover how your visitors truly engage with your most important web pages that impact the success of your business. Heatmaps shows you visually where your visitors try to click, move the mouse and how far down they scroll on each page.
You don’t need to waste time digging for key metrics or worry about putting together tables of data to understand how your visitors are interacting with your website. Heatmaps make it easy and fast to discover where your users are paying their attention, where they have problems, where useless content is and how engaging your content is. Get insights that you cannot get from traditional reports. Learn more
3. Carry out A/B testing
With A/B Testing you reduce risk in your decision-making and can test what your visitors are responding well to.
Ever had discussions with colleagues about where to place content on a landing page ? Or discussed what the call-to-action should be and assumed you were making the best decisions ? The truth is, you never know what really works the best (and what doesn’t) unless you test it. Learn more
How to increase engagement with A/B Testing : Test, test and test. This is a surefire way to learn what content is leading your visitors on a path to conversion and what isn’t.
4. Media Analytics
Tells you how visitors are engaging with your video or audio content, and whether they’re leading to your desired conversions. Track :
- How many plays your media gets and which parts they viewed
- Finish rates
- How your media was consumed over time
- How media was consumed on specific days
- Which locations your users were viewing your content from
- Learn more
How to increase engagement with Media Analytics : These metrics give a picture of how audiences are behaving when it comes to your content. By showing insights such as, how popular your media content is, how engaging it is and which days content will be most viewed, you can tailor content strategies to produce content people will actually find interesting and watch/listen.
Matomo example : When we went through the feature video metrics on our own site to see how our videos were performing, we noticed our Acquisition video had a 95% completion rate. Even though it was longer than most videos, the stats showed us it had, by far, the most engagement. By using Media Analytics to get insights on the best and worst performing videos, we gathered useful info to help us better allocate resources effectively so that in the future, we’re producing more videos that will be watched.
5. Investigate transitions
See which page visitors are entering the site from and where they exit to. Transitions shows engagement on each page and whether the content is leading them to the pages you want them to be directed to.
This gives you a greater understanding of user pathways. You may be assuming visitors are finding your content from one particular pathway, but figure out users are actually coming through other channels you never thought of. Through Transitions, you may discover and capitalise on new opportunities from external sites.
How to increase engagement with Transitions : Identify clearly where users may be getting distracted to click away and where other pages are creating opportunity to click-through to conversion.
6. Create Custom Reports
You can choose from over 200 dimensions and metrics to get the insights you need as well as various visualisation options. This makes understanding the data incredibly easy and you can get the insights you need instantly for faster results without the need for a developer. Learn more
How to increase engagement with Custom Reports : Set custom reports to see when content is being viewed and figure out how engaged users are by looking at different hours of the day or which days of the week they’re visiting your website. For example, you could be wondering what hour of the day performed best for converting your customers. Understanding these metrics helps you figure out the best time to schedule your blog posts, pay-per-click advertising, edms or social media posts knowing that your visitors are more likely to convert at different times.
7. Other metrics to key an eye on …
A good indication of a great experience and of engagement is whether your readers, viewers or listeners want to do it again and again.
“Best” metrics are hard to determine so you’ll need to ask yourself what you want to do or what you want your site to do. How do you want your users to behave or what kind of buyer’s journey do you want them to have ?
Want to know where to start ? Look at …
- Bounce rate – a high bounce rate isn’t great as people aren’t finding what they’re looking for and are leaving without taking action. (This offers great opportunities as you can test to see why people are bouncing off your site and figure out what you need to change.)
- Time on site – a long time on site is usually a good indication that people are spending time reading, navigating and being engaged with your website.
- Frequency of visit – how often do people come back to interact with the content on your website ? The higher the % of your visitors that come back time and time again will show how engaged they are with your content.
- Session length/average session duration – how much time users spend on site each session
- Pages per session – is great to show engagement because it shows visitors are happy going through your website and learn more about your business.
Key takeaway
Whichever stage of the buyer’s journey your visitors are in, you need to ensure your content is optimised for engagement so that visitors can easily spend time on your website.
“Every single visit by every single visitor is no longer judged as a success or a failure at the end of 29 min (max) session in your analytics tool. Every visit is not a ‘last-visit’, rather it becomes a continuous experience leading to a win-win outcome.” – Avinash Kaushik
As you can tell, one size does not fit all when it comes to analysing and measuring engagement, but with a toolkit of features, you can make sure you have everything you need to experiment and figure out the metrics that matter to the success of your business and website.
Concurrently, these gentle nudges for visitors to consume more and more content encourages them along their path to purchase, conversion or loyalty. They get a more engaging website experience over time and you get happy visitors/customers who end up coming back for more.
Want to learn how to increase conversions with Matomo ? Look out for the final in this series : part 3 ! We’ll go through how you can boost conversions and meet your business goals with web analytics.
-
Stuttering rendering using ffmpeg and sdl2
22 décembre 2020, par Wiesen_WalleWith the following Code I get a stuttering rendering of the movie file. Interesstingly, when dumping information with ffmpeg it says it has 25 fps and a duration of 00:01:32.90 ; however when counting the frames and time it runs by myself it gives a time of about 252 seconds, I guess the code receiving the frames and sending the package (int cap(vid v)) draws the same frame multiple of times. But I cannot see what's wrong ?


//PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/:/usr/lib64/pkgconfig/ --> add path to PKF_Config search path
//export PKG_CONFIG_PATH --> export PKG_Config search path to become visible for gcc
//gcc ffmpeg_capture_fl.c -Wall -pedantic -fPIC `pkg-config --cflags --libs libavdevice libavformat libavcodec libavutil libavdevice libavfilter libswscale libswresample sdl2`


#include <libavdevice></libavdevice>avdevice.h>
#include <libavutil></libavutil>opt.h>
#include <libavformat></libavformat>avformat.h>
#include <libavcodec></libavcodec>avcodec.h>
#include <libswscale></libswscale>swscale.h>
#include <libavutil></libavutil>imgutils.h>
#include 
#include 
#include <libavutil></libavutil>rational.h>
#include <sys></sys>time.h>
#include 


typedef struct vid{
AVFormatContext *inc;
AVInputFormat *iformat;
AVCodecContext *pCodecCtx;
AVCodec *pCodec;
AVFrame *pFrame;
int videoStream;} vid;

typedef struct sws{
struct SwsContext *ctx;
uint8_t **buffer;
int *linesize;
} sws;


vid cap_init_fl(char *fl);
int cap(vid v);
void cap_close(vid v);

sws init_swsctx(int width, int height, enum AVPixelFormat pix_fmt, int new_width, int new_height, enum AVPixelFormat new_pxf);
void conv_pxlformat(sws scale, uint8_t **src_data, int *src_linesize, int height);
void free_sws(sws inp);

#include <sdl2></sdl2>SDL.h>

typedef struct sdl_window{
 SDL_Window *window;
 SDL_Renderer *renderer;
 SDL_Texture *texture;
 SDL_Event *event;
 int width;
 int height;
 int pitch;
 uint32_t sdl_pxl_frmt;
 }sdl_window;

sdl_window init_windowBGR24_ffmpg(int width, int height);
int render_on_texture_update(sdl_window wow, uint8_t *data);
void close_window(sdl_window wow);


vid cap_init_fl(char *fl){
 vid v = {NULL, NULL, NULL, NULL, NULL, -1};
 int i;
 
 av_register_all();
 avdevice_register_all();

 if( 0 > avformat_open_input( &(v.inc), fl , v.iformat, NULL)) {
 printf("Input device could not been opened\n");
 cap_close(v);
 exit(1);
 }

 if(avformat_find_stream_info(v.inc, NULL)<0){
 printf("Stream information could not been found.\n");
 cap_close(v);
 exit(2);
 }

 // Dump information about file onto standard error
 av_dump_format(v.inc, 0, fl, 0);

 // Find the first video stream
 v.videoStream=-1;
 for(i=0; inb_streams; i++){
 if(v.inc->streams[i]->codecpar->codec_type==AVMEDIA_TYPE_VIDEO) {
 v.videoStream=i;
 break;
 }}

 if(v.videoStream==-1){
 printf("Could not find video stream.\n");
 cap_close(v);
 exit(3);
 }

 // Find the decoder for the video stream
 v.pCodec=avcodec_find_decoder(v.inc->streams[v.videoStream]->codecpar->codec_id);
 if(v.pCodec==NULL) {
 printf("Unsupported codec!\n");
 cap_close(v);
 exit(4);
 // Codec not found
 }

 

 // Get a pointer to the codec context for the video stream
 
 if((v.pCodecCtx=avcodec_alloc_context3(NULL)) == NULL){
 printf("Could not allocate codec context\n");
 cap_close(v);
 exit(10);}

 avcodec_parameters_to_context (v.pCodecCtx, v.inc->streams[v.videoStream]->codecpar); 
 
 // Open codec
 if(avcodec_open2(v.pCodecCtx, v.pCodec, NULL)<0){
 printf("Could not open codec");
 cap_close(v);
 exit(5);
 }
 
 
 // Allocate video frame
 v.pFrame=av_frame_alloc();
 if(v.pFrame==NULL){
 printf("Could not allocate AVframe");
 cap_close(v);
 exit(6);}

 
 return v;
}



int cap(vid v){
 int errorCodeRF, errorCodeSP, errorCodeRecFR;
 AVPacket pkt;
 
 if((errorCodeRF = av_read_frame(v.inc, &pkt)) >= 0){
 
 if (pkt.stream_index == v.videoStream) {
 
 errorCodeSP = avcodec_send_packet(v.pCodecCtx, &pkt);
 
 if (errorCodeSP >= 0 || errorCodeSP == AVERROR(EAGAIN)){
 
 errorCodeRecFR = avcodec_receive_frame(v.pCodecCtx, v.pFrame);
 
 if (errorCodeRecFR < 0){ 
 av_packet_unref(&pkt);
 return errorCodeRecFR;
 }
 else{
 av_packet_unref(&pkt);
 return 0;
 }
 
 }
 else{
 av_packet_unref(&pkt);
 return errorCodeSP;}
 
 }}
 
 else{
 return errorCodeRF;}
 return 1;
 }
 
 

void cap_close(vid v){
 if(v.pFrame != NULL) av_free(v.pFrame);
 avcodec_close(v.pCodecCtx);
 avformat_close_input(&(v.inc));
 if(v.inc != NULL) avformat_free_context(v.inc);
 
 v.inc = NULL;
 v.iformat = NULL;
 v.pCodecCtx = NULL;
 v.pCodec = NULL;
 v.pFrame = NULL;
 v.videoStream=-1;}



sws init_swsctx(int width, int height, enum AVPixelFormat pix_fmt, int new_width, int new_height, enum AVPixelFormat new_pxf){

int nwidth, nheight;
sws scale;

scale.buffer = (uint8_t **) malloc(4 * sizeof(uint8_t *));
scale.linesize = (int *) malloc(4 * sizeof(int));


nwidth = (new_width <= 0) ? width : new_width;
nheight = (new_height <= 0) ? height : new_height;

av_image_alloc(scale.buffer, scale.linesize, nwidth, nheight, new_pxf, 1);
scale.ctx = sws_getContext(width, height, pix_fmt, nwidth, nheight, new_pxf, SWS_BILINEAR, NULL, NULL, NULL);

if(scale.ctx==NULL){
 printf("Could not allocate SWS-Context\n");
 av_freep(&(scale.buffer)[0]);
 free(scale.buffer);
 free(scale.linesize);
 exit(12);
 }
 
return scale;}


void conv_pxlformat(sws scale, uint8_t **src_data, int *src_linesize, int height){ 
 sws_scale(scale.ctx, (const uint8_t **) src_data, src_linesize, 0, height, scale.buffer, scale.linesize);
 }


void free_sws(sws inp){
 av_freep(&(inp.buffer)[0]);
 free(inp.buffer);
 free(inp.linesize); 
}


sdl_window init_windowBGR24_ffmpg(int width, int height){

 sdl_window wow;
 
 if (SDL_Init(SDL_INIT_VIDEO) < 0) {
 printf("Couldn't initialize SDL in function: create_sdl_window(...)\n");
 exit(7);}
 
 wow.window = SDL_CreateWindow("SDL_CreateTexture",
 SDL_WINDOWPOS_UNDEFINED,
 SDL_WINDOWPOS_UNDEFINED,
 width, height,
 SDL_WINDOW_RESIZABLE);

 wow.renderer = SDL_CreateRenderer(wow.window, -1, SDL_RENDERER_ACCELERATED);
 wow.texture = SDL_CreateTexture(wow.renderer, SDL_PIXELFORMAT_BGR24, SDL_TEXTUREACCESS_STREAMING, width, height);
 wow.width = width;
 wow.height = height;
 wow.pitch = width * 3; //only true for 3 byte / 24bit packed formats like bgr24
 wow.sdl_pxl_frmt = SDL_PIXELFORMAT_BGR24;
 SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear"); 
 SDL_SetHint(SDL_HINT_RENDER_VSYNC, "enable"); 
 SDL_RenderSetLogicalSize(wow.renderer, wow.width, wow.height);
 return wow;
}


int render_on_texture_update(sdl_window wow, uint8_t *data){
 
 if (SDL_UpdateTexture(wow.texture, NULL, data, wow.pitch)< 0){
 printf("SDL_render_on_texture_update_failed: %s\n", SDL_GetError());
 return -1;
 }
 SDL_RenderClear(wow.renderer);
 SDL_RenderCopy(wow.renderer, wow.texture, NULL, NULL);
 SDL_RenderPresent(wow.renderer);

 return 0; 
}


void close_window(sdl_window wow){
 SDL_DestroyRenderer(wow.renderer);
 SDL_Quit();
}




int main(){
 int n, vid_error;
 long int time_per_frame_usec, duration_usec;
 vid v;
 sdl_window wow;
 struct timeval tval_start, tval_start1, tval_end, tval_duration;
 sws scale;
 SDL_Event event;
 
 vid_error = AVERROR(EAGAIN);
 v = cap_init_fl("mw_maze_test.mp4"); 
 
 while(vid_error == AVERROR(EAGAIN)){
 vid_error =cap(v);}
 
 if(vid_error < 0){
 printf("Could not read from Capture\n");
 cap_close(v);
 return 0;
 }

 wow = init_windowBGR24_ffmpg((v.pCodecCtx)->width, (v.pCodecCtx)->height);
 scale = init_swsctx((v.pCodecCtx)->width, (v.pCodecCtx)->height, (v.pCodecCtx)->pix_fmt, 0, 0, AV_PIX_FMT_BGR24);
 
 time_per_frame_usec = ((long int)((v.inc)->streams[v.videoStream]->avg_frame_rate.den) * 1000000 / (long int) ((v.inc)->streams[v.videoStream]->avg_frame_rate.num));
 
 printf("Time per frame: %ld\n", time_per_frame_usec);
 n = 0;
 
 gettimeofday(&tval_start, NULL);
 gettimeofday(&tval_start1, NULL);
 
 while ((vid_error =cap(v)) >= 0) {
 
 if (SDL_PollEvent(&event) != 0) {
 if (event.type == SDL_QUIT)
 break;}
 
 conv_pxlformat(scale, (v.pFrame)->data, (v.pFrame)->linesize, (v.pCodecCtx)->height);
 gettimeofday(&tval_end, NULL);
 timersub(&tval_end, &tval_start, &tval_duration);
 duration_usec = (long int)tval_duration.tv_sec * 1000000 + (long int)tval_duration.tv_usec;
 
 while(duration_usec < time_per_frame_usec) {
 gettimeofday(&tval_end, NULL);
 timersub(&tval_end, &tval_start, &tval_duration);
 duration_usec = (long int)tval_duration.tv_sec * 1000000 + (long int)tval_duration.tv_usec;
 }
 
 gettimeofday(&tval_start, NULL);
 render_on_texture_update(wow, *(scale.buffer)); 
 n++;
 }
 
 gettimeofday(&tval_end, NULL);
 timersub(&tval_end, &tval_start1, &tval_duration);
 duration_usec = (long int)tval_duration.tv_sec * 1000000 + (long int)tval_duration.tv_usec;
 
 printf("Total time and frames; %ld %i\n", duration_usec, n);
 
 if(vid_error == AVERROR(EAGAIN)){
 printf("AVERROR(EAGAIN) occured\n)");
 } 
 
 
 sws_freeContext(scale.ctx);
 free_sws(scale);
 close_window(wow);
 cap_close(v); 
 return 0; 
}




the output is:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'mw_maze_test.mp4':
 Metadata:
 major_brand : mp42
 minor_version : 0
 compatible_brands: isommp42
 creation_time : 2014-02-14T21:09:52.000000Z
 Duration: 00:01:32.90, start: 0.000000, bitrate: 347 kb/s
 Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 384x288 [SAR 1:1 DAR 4:3], 249 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc (default)
 Metadata:
 handler_name : VideoHandler
 Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 96 kb/s (default)
 Metadata:
 creation_time : 2014-02-14T21:09:53.000000Z
 handler_name : IsoMedia File Produced by Google, 5-11-2011
Time per frame: 40000
Total time and frames; 252881576 6322