Recherche avancée

Médias (0)

Mot : - Tags -/upload

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (35)

  • La file d’attente de SPIPmotion

    28 novembre 2010, par

    Une 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 (...)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • Ecrire une actualité

    21 juin 2013, par

    Présentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
    Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
    Vous pouvez personnaliser le formulaire de création d’une actualité.
    Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)

Sur d’autres sites (6498)

  • 8 Best Tools to Analyse Website Traffic

    12 septembre 2023, par Erin — Analytics Tips, Marketing

    Do you want to analyse your website traffic ?

    Maybe you want to know how well you’re converting your traffic. Or maybe you’re looking to track the performance and ROI of your marketing campaigns. Regardless, you won’t get far without relying on a dependable web traffic analysis platform.

    In this article, we’ve compiled a list of the top web analytics tools available (including the pricing for each one).

    Let’s dive in.

    What is website traffic analysis ?

    Curious about what it means to analyse website traffic ?

    What is website traffic analysis?

    Simply put, it involves collecting and examining data about your website visitors and the actions they take. Marketers, analysts and website owners can then take this data and use it to optimise their strategy to improve site traffic, conversion rates and ROI.

    A website analytics tool is software that tracks and measures various visitor activities and behaviours on your website. Common metrics include pageviews, traffic source, bounce rate and average time on page. Using a web analytics solution can give you insights into what’s working (and what’s not working) so you can optimise your website, campaigns or marketing strategy.

    Advantages of using a website traffic analysis tool

    1. Performance measurement and optimisation

    Tracking the success of your marketing efforts is a challenging task. The primary benefit of using a web analytics tool is implementing effective performance measurement. If you don’t know how to measure your efforts, you won’t know what’s working and what’s not with your campaigns and content. 

    A web analysis tool can give you the insights you need to understand whether your marketing initiatives have been successful or if they need to be improved.

    For instance, your new web design facelift may seem beautiful, but if visitors aren’t staying on your site as long and it is resulting in lower conversions, then it’s time to go back to the drawing board.

    2. Audience insights to improve the user experience

    Web traffic analysis platforms don’t just show you what your visitors are doing. It shows you who your audience is. A powerful website analytics tool will give you in-depth audience data, including demographics like geographical location (e.g., city, state or country), to help you better understand your audience.

    Additionally, you can learn more about your audience by seeing how they interact with different content on your site. You’ll start to see that certain content performs better than others, giving you a greater understanding of your audience’s needs and wants. This means you’ll be able to tailor your website content and marketing efforts to your audience to improve the overall user experience.

    3. Improve SEO

    In the first two advantages, we touched on how insights can help you craft better content for the visitors already coming to your site to improve the user experience and improve conversions. But did you know that using a website analytics tool can also help improve how much traffic you’re getting to your site ?

    Since a web analytics tool can help you craft better content, one side effect is an increase in traffic from organic search through SEO. Additionally, your platform will likely show you other traffic sources that your visitors are coming from (i.e., another website is referring traffic to you) so you can tap into those high-performing sources and optimise your incoming traffic over time.

    Top 8 Tools to Analyse Website Traffic

    Here’s a breakdown of the top eight web analytics platforms to help you analyse each tool’s unique features, price, advantages and disadvantages so you can make the best decision.

    1. Matomo

    Matomo is an open-source website analytics tool that’s focused on protecting user privacy and data while offering robust insights into your web traffic. It’s one of the most powerful tools to track the entire customer journey on your site.

    Matomo main dashboard

    Why Matomo : As the leader in open-source, privacy-friendly and ethical web analytics, Matomo is trusted by more than 1 million websites, including NASA, the United Nations and the European Commission.

    Matomo plays well with Google Analytics to track your websites by filling in the gaps where Google Analytics has limitations (i.e., cookie consent banner requirement). Matomo combines traditional and behavioural web analytics for deeper insights while ensuring compliance with the strictest privacy regulations like GDPR, LGPD and HIPAA.

    Matomo Standout Features and Integrations :

    Standout features include comprehensive visitor tracking, multi-attribution, goal tracking, event tracking, custom dimensions, custom reports, automated email reports, session recordings, tag manager, roll-up reporting to pull data from multiple sites, Google Analytics importer, heatmaps and more.

    Integrations include WordPress, Google Ads, Wix, Drupal, Joomla, Cloudflare, Magento, Vue, SharePoint, WooCommerce and more.

    Pricing starts free for Matomo On-Premise (but requires technical skills and servers to set up) and $23/month for Matomo Cloud, which includes a 21-day free trial (no credit card required).

    Pros

    • Best for respecting visitor privacy
    • You own your data — ensuring that it’s not shared with third parties for purposes like advertising
    • Compliant with the strictest privacy laws
    • Greater flexibility with open-source advantages, as well as the option to either self-host or cloud host
    • Can run cookieless — providing 100% accurate data and a better user experience without the need for an annoying cookie consent banner 
    • Exceptional customisability — from white labeling, alerts and custom dimensions to dashboards and reports, tailor your insights for faster decisions, deeper insights and superior outcomes

    Cons

    • On-Premise is free, but there are additional costs for advanced features
    • On-Premise requires servers and technical expertise to manage

    2. Google Analytics

    Google Analytics is the most well-known and used web analytics platform in the world, with nearly 30 million active websites.

    Google Analytics 4 dashboard

    Why Google Analytics : It’s one of the leading web traffic analysis tools backed by the Alphabet group of companies. For anyone getting started, it’s a great free option to understand your web traffic and your audience.

    Google Analytics Standout Features and Integrations :

    Standout features include in-depth visitor tracking, event tracking with Google Analytics 4 (GA4), easy integration with Google marketing tools (i.e., Google Search Console and Google Ads), custom reports and easy data importing from third-party sources.

    Integrations include Google Ads, Google Webmaster Tools, AdSense, WordPress, Wix, Shopify, Zendesk, Facebook, Marketo, WordPress, Hotjar, SEMrush, Salesforce, Hootsuite and more.

    Pricing is free.

    Pros

    • Detailed audience insights
    • Customisable reports
    • Seamless integration with other Google products
    • Easy to set up

    Cons

    • Not privacy-friendly — you don’t own your data (data is shared with third parties for advertising purposes)
    • Complex interface
    • Requires cookie consent banner for GDPR compliance, which negatively impacts data accuracy and user experience

    3. Fathom Analytics

    Founded in 2018, Fathom Analytics is a privacy-friendly and lightweight web analytics tool. The platform offers a simple, minimalistic dashboard.

    Fathom Analytics Dashboard

    Why Fathom Analytics : Fathom Analytics is a minimalistic tool to help website owners gain insights into customer behaviour without compromising on privacy. It’s an easy-to-use tool that offers a simplified breakdown of the most popular data points. For newcomers to web analytics seeking essential metrics like visitor counts and traffic sources, Fathom Analytics provides a straightforward, cost-effective solution.

    Fathom Analytics Standout Features and Integrations :

    Standout features include easy, automated GA4 importing with lifetime data retention, a single-page dashboard for a quick overview of metrics, traffic summaries for chosen timeframes, visually striking graphs for better data digestion and privacy protection covering major compliance regulations.

    Integrations include Google Analytics, Squarespace, Drupal, WordPress, Discourse, Bloggi, ConvertKit, Webflow, Transistor, Remix, Gatsby and Carrd.

    Pricing starts at $14/month for up to 100k pageviews (with a 30-day free trial).

    Pros

    • Doesn’t use cookies
    • Out-of-the-box GDPR, ePrivacy, PECR and CCPA compliance
    • Great for visual data insights
    • Lightweight tracking script for fast loading

    Cons

    • Can’t easily see traffic trends on specific pages
    • Metrics may be too simple for those wanting advanced analytics

    4. Mixpanel

    Mixpanel is a web analytics platform that helps you track visitors as well as improve customer retention. The software has 8,000 customers worldwide, including Netflix, Yelp, BuzzFeed and CNN.

    Mixpanel custom dashboard

    Why Mixpanel : Mixpanel is great for websites with e-commerce functionality. The tool helps you understand both your site visitors and your customers so you can optimise your customer experience and improve conversions.

    Mixpanel Standout Features and Integrations :

    Standout features include deep insights into how your products are being used, including your most popular features, user cohorts that let you segment users based on specific actions, and visual analysis showing where users drop off.

    Integrations include Google Cloud, Figma, Mailchimp, Zoho CRM, Databox, Marketo, Hotjar, Slack, Zapier, Amazon Web Services, Google Ads and HubSpot.

    Pricing starts free for up to 20 million events per month and $20/month for Growth.

    Pros

    • Interface is easy for beginners
    • Exhaustive reporting options
    • Custom event tracking options
    • Predict user actions based on data science models
    • Send targeted messages to specific users to encourage action

    Cons

    • User-based pricing isn’t the most ideal for everyone
    • Alert management can be confusing

    5. Kissmetrics

    Kissmetrics is a marketing and product analytics tool that helps e-commerce and SaaS companies grow through qualitative data insights. The web analytics tool is trusted by 10,000 users, including Microsoft, Unbounce, AWeber, Dropbox DocSend and SendGrid.

    Kissmetrics dashboard

    Why Kissmetrics : As an e-commerce-driven analytics platform, the platform is best suited for Enterprise businesses, but it also offers flexible pricing plans that make it easy for someone to get their feet wet with website analytics. 

    Kissmetrics Standout Features and Integrations :

    Standout features include a customisable dashboard to see key metrics at a glance, comprehensive visitor tracking, cohort analysis including power user tracking to understand your most active visitors and customers and insights into customer lifetime value and churn rate.

    Integrations include Chargify, HubSpot, Slack, Live Chat, Marketo, Optimizely, Mailchimp, Recurly, Wufoo Forms, Facebook Ads, WordPress, Shopify and WooCommerce.

    Pricing starts at $0.0025/event for the Pay As You Go Plan, $25.99/month for Build Your Plan and $199/month for Small Teams, which includes a 7-day free trial.

    Pros

    • Flexible pricing options
    • Easy to install
    • Several analytics viewing options
    • Visual checkout funnel insights
    • Track sessions by desktop or mobile

    Cons

    • Despite more pricing options, it’s still quite expensive overall
    • Difficult to use for beginners

    6. Adobe Analytics

    Adobe Analytics is a web and marketing analytics platform within the Adobe Experience Platform. Used by over 170,000 businesses, it’s one of the most popular analytics solutions available.

    dobe Analytics dashboard

    Why Adobe Analytics : Adobe Analytics was created for large organisations. It’s essentially the enterprise version of Google Analytics. The tool does a great job of offering a customised analytics solution that’s capable of delivering personalised user experiences at scale.

    Adobe Analytics Standout Features and Integrations :

    Standout features include attribution, AI-driven predictive analytics, robust customer segmentation and automation based on customer behaviour.

    Integrations include all Adobe products, Salesforce, Hootsuite, Contentsquare, Sisense, Mouseflow, Google Ads, Google Search Console, HubSpot and Microsoft Teams.

    Pricing is custom and available upon request, but users can expect to pay at least $2,000 per month, and there is no free trial.

    Pros

    • Built for enterprise businesses
    • Seamless workflow integration for Adobe Experience Cloud users
    • Incredible customisation options
    • Integration process is flexible
    • Capable of accurately tracking large volumes of traffic

    Cons

    • Very expensive
    • Not suitable for small businesses
    • The setup is challenging for beginners

    7. SimilarWeb

    SimilarWeb is a robust analytics platform used to track your website data and compare it to other websites. Backed by a team of experienced data scientists and mathematicians for in-depth website traffic and search engine analysis. Founded in 2007, the platform is trusted by major brands like Adidas, DHL, PepsiCo and Walmart.

    SimilarWeb dashboard

    Why SimilarWeb : The tool relies on multiple scientific methodologies and approaches to data analysis to help provide a better understanding of visitors and customers. The platform is great for crafting prediction models for customer acquisitions by using machine learning to offer SEO insights and competitive analysis.

    SimilarWeb Standout Features and Integrations :

    Standout features include competition traffic and engagement analysis, in-depth visitor tracking, keyword analysis to optimise your SEO and search ads, affiliate traffic analysis, search traffic analysis and funnel insights.

    Integrations include Salesforce, HubSpot, Google Analytics, Google Search Console, Shift, AT Internet, Adverity, SimilarTech, Biscience and more. 

    Pricing starts at $125/month for the Starter plan, which includes a 7-day free trial.

    Pros

    • Has a user-friendly dashboard for simple insights
    • Highly customisable platform to meet your specific needs
    • Easy competition analysis
    • Funnel insights to improve your conversion rates
    • Great customer support

    Cons

    • Expensive pricing
    • Doesn’t include a code snippet to pull data directly from websites
    • Doesn’t show sub-domains of your site

    8. Hotjar

    Hotjar is a behavioural website analytics tool with a focus on providing insights into individual user sessions with features like heatmaps and session recordings. Founded in 2014, Hotjar is used by 900,000 sites around the world.

    Hotjar heat mapping

    Why Hotjar : Unlike traditional web analytics tools like Google Analytics, Hotjar is a behavioural analytics tool that provides in-depth behaviour insights session by session. The tool offers a variety of features that give you a sneak peek into your users’ behaviours by watching how they interact with your site action by action.

    Hotjar Standout Features and Integrations :

    Standout features include comprehensive heat mapping, visitor session recordings to see what visitors did moment by moment, feedback polls to gain insights from site visitors and conversion funnels to help you analyse leaks in your funnel at each conversion stage.

    Integrations include HubSpot, Slack, Jira, WordPress, Shopify, Google Analytics, Mixpanel, Microsoft Teams, Zapier and ClickFunnels.

    Pricing starts at free for the Basic plan and $80/month for Business, which includes a 15-day free trial.

    Pros

    • You can see exactly where visitors click, move and scroll
    • Watch session replays to see what visitors did step-by-step
    • See what percentage of visitors take certain actions
    • Data segmentation features to help you understand KPIs in-depth
    • There are no user limits with the platform, making it easy to scale

    Cons

    • While it offers behavioural analytics, Hotjar doesn’t provide insights into traditional web analytics like Matomo does, including traffic sources and bounce rate
    • History data monitoring is complex

    Elevate your website performance today

    Understanding your visitors’ behaviour and needs is essential when you’re looking to improve your website performance.

    By leveraging a website analytics platform, you’ll be able to gain new insights into your visitors and use insights from your content and campaign performance to improve your user experience.

    If you’re looking to start using a web traffic analysis tool today, then Matomo is an excellent choice.

    Matomo is a powerful, privacy-friendly and compliant tool that gives in-depth insights into your audience, your content and your marketing efforts to help you improve your site’s performance.

    The platform also includes a variety of robust behavioural analytics features like heatmaps, session recording and more, which are included in your Cloud subscription. 

    Start your 21-day free trial of Matomo today (no credit card required).

  • Revision 3327 : Le modèle pour les images prenant en compte les largeurs et autres ...

    25 avril 2010, par kent1 — Log

    Le modèle pour les images prenant en compte les largeurs et autres hauteurs fixées au modèle

  • How to Crop the visible portion of landscape video in android ?

    30 août 2016, par Deepak
    1. I am working on Panning and cropping the landscape video using Texture View.I am in a half way that I can pan the landscape video from left to right vice versa by using this example
      https://github.com/crust87/Android-VideoCropView.

    enter image description here

    enter image description here

    1. FFMPEG can crop the particular portion of the video by using this command
      ffmpeg -i /sdcard/videokit/in.mp4 -filter:v crop=720:1088:0:0 -c:a
      copy /sdcard/videokit/out.mp4

    How can I crop only the video which is visible in Texture View and save it local storage in Android.

    crop=720:1088:0:0 is a hard coded width and height of the video and it is cropping fine.But how can I get the width and height of the visible video in Texture View to crop the visible video and Save it to the local storage in android.

    public class MainActivity extends Activity {

       // Layout Components
       private FrameLayout top_frame;

       // Attributes
       private String originalPath;
       @Override
       protected void onCreate(Bundle savedInstanceState) {
           super.onCreate(savedInstanceState);
           setContentView(R.layout.check);
           top_frame = (FrameLayout)findViewById(R.id.top_frame);
       }

       @Override
       protected void onActivityResult(int requestCode, int resultCode, Intent data) {
           if (requestCode == 1000 && resultCode == RESULT_OK) {
               final VideoCropView mVideoCropView = new VideoCropView(this);
               mVideoCropView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {

                   @Override
                   public void onPrepared(MediaPlayer mp) {
                       mVideoCropView.start();
                   }
               });
               top_frame.addView(mVideoCropView);
               Uri selectedVideoUri = data.getData();

               originalPath = getRealPathFromURI(selectedVideoUri);

               mVideoCropView.setVideoURI(selectedVideoUri);

               mVideoCropView.seekTo(1);
           }
       }

       public void onButtonLoadClick(View v) {
           top_frame.removeAllViews();
           Intent lIntent = new Intent(Intent.ACTION_PICK);
           lIntent.setType("video/*");
           lIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
           startActivityForResult(lIntent, 1000);
       }

       public String getRealPathFromURI(Uri contentUri) {    // getting image path from gallery.
           Cursor cursor = null;
           try {
               String[] proj = { MediaStore.Images.Media.DATA };
               cursor = getApplicationContext().getContentResolver().query(contentUri, proj, null, null, null);
               int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
               cursor.moveToFirst();
               return cursor.getString(column_index);
           } finally {
               if (cursor != null) {
                   cursor.close();
               }
           }
       }

    }

    CropVideoView

    public class VideoCropView extends TextureView implements MediaPlayerControl {
       // Constants
       private static final String LOG_TAG = "VideoCropView";
       private static final int STATE_ERROR = -1;
       private static final int STATE_IDLE = 0;
       private static final int STATE_PREPARING = 1;
       private static final int STATE_PREPARED = 2;
       private static final int STATE_PLAYING = 3;
       private static final int STATE_PAUSED = 4;
       private static final int STATE_PLAYBACK_COMPLETED = 5;

       // MediaPlayer Components
       protected Context mContext;
       private MediaPlayer mMediaPlayer;
       private Surface mSurface;
       private OnInfoListener mOnInfoListener;
       private OnCompletionListener mOCompletionListener;
       private OnErrorListener mOnErrorListener;
       private OnPreparedListener mOnPreparedListener;
       private OnTranslatePositionListener mOnTranslatePositionListener;

       // CropView Components
       private Matrix mMatrix;

       // MediaPlayer Attributes
       protected Uri mUri;
       private int mCurrentBufferPercentage;
       private int mSeekWhenPrepared;
       protected int mVideoWidth;
       protected int mVideoHeight;

       // CropView Attributes
       private float mRatioWidth;
       private float mRatioHeight;
       private float mPositionX;
       private float mPositionY;
       private float mBoundX;
       private float mBoundY;
       private int mRotate;
       private float mScaleX;
       private float mScaleY;
       private float mScale;

       // Working Variables
       private int mCurrentState = STATE_IDLE;
       private int mTargetState = STATE_IDLE;

       // Touch Event
       // past position x, y and move point
       float mPastX;
       float mPastY;
       float mTouchDistance;
       private Context context;

       // Constructors
       public VideoCropView(final Context context) {
           super(context);
           mContext = context;

           initAttributes();
           initVideoView();
       }

       public VideoCropView(final Context context, final AttributeSet attrs) {
           super(context, attrs);
           mContext = context;

           initAttributes(context, attrs, 0);
           initVideoView();
       }

       public VideoCropView(Context context, AttributeSet attrs, int defStyleAttr) {
           super(context, attrs, defStyleAttr);
           mContext = context;

           initAttributes(context, attrs, defStyleAttr);
           initVideoView();
       }

       private void initAttributes() {
           mRatioWidth = 1;
           mRatioHeight = 1;
       }

       private void initAttributes(Context context, AttributeSet attrs, int defStyleAttr) {
           TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.VideoCropView, defStyleAttr, 0);

           mRatioWidth = typedArray.getInteger(R.styleable.VideoCropView_ratio_width, 3);
           mRatioHeight = typedArray.getInteger(R.styleable.VideoCropView_ratio_height, 4);
       }

       @Override
       protected void onMeasure(final int widthMeasureSpec, final int heightMeasureSpec) {
           int heightLayout;
           int widthLayout;
           widthLayout = MeasureSpec.getSize(widthMeasureSpec);
           heightLayout = MeasureSpec.getSize(heightMeasureSpec);
           setMeasuredDimension(widthLayout, heightLayout);

           /*if(widthMeasureSpec < heightMeasureSpec){

               int width = MeasureSpec.getSize(widthMeasureSpec);
               int height = (int) ((width / mRatioWidth) * mRatioHeight);


               setMeasuredDimension(width, height);

           }else{

               int width = MeasureSpec.getSize(widthMeasureSpec);
               int height =MeasureSpec.getSize(heightMeasureSpec);
               setMeasuredDimension(width, height);

           }
    */
       }

       @Override
       public boolean onTouchEvent(MotionEvent event) {
           if(mCurrentState == STATE_ERROR || mCurrentState == STATE_IDLE || mCurrentState == STATE_PREPARING) {
               return false;
           }

           switch (event.getAction()) {
               case MotionEvent.ACTION_DOWN:
                   mPastX = event.getX();
                   mPastY = event.getY();
                   mTouchDistance = 0;
               case MotionEvent.ACTION_MOVE:
                   if(mBoundX!=0 || mBoundY!=0) {
                       float dx = event.getX() - mPastX;
                       float dy = event.getY() - mPastY;
                       updateViewPosition(dx, dy);
                       mPastX = event.getX();
                       mPastY = event.getY();
                       mTouchDistance += (Math.abs(dx) + Math.abs(dy));
                   }
                   break;
               case MotionEvent.ACTION_UP:
                   if (mTouchDistance < 25) {
                       if (isPlaying()) {
                           pause();
                       } else {
                           start();
                       }
                   }

                   mTouchDistance = 0;
                   break;
           }

           return true;
       }

       @Override
       public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
           super.onInitializeAccessibilityEvent(event);
           event.setClassName(VideoView.class.getName());
       }

       @Override
       public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
           super.onInitializeAccessibilityNodeInfo(info);
           info.setClassName(VideoView.class.getName());
       }

       public int resolveAdjustedSize(int desiredSize, int measureSpec) {
           Log.d(LOG_TAG, "Resolve called.");
           int result = desiredSize;
           int specMode = MeasureSpec.getMode(measureSpec);
           int specSize = MeasureSpec.getSize(measureSpec);

           switch (specMode) {
               case MeasureSpec.UNSPECIFIED:
               /*
                * Parent says we can be as big as we want. Just don't be larger
                * than max size imposed on ourselves.
                */
                   result = desiredSize;
                   break;

               case MeasureSpec.AT_MOST:
               /*
                * Parent says we can be as big as we want, up to specSize. Don't be
                * larger than specSize, and don't be larger than the max size
                * imposed on ourselves.
                */
                   result = Math.min(desiredSize, specSize);
                   break;

               case MeasureSpec.EXACTLY:
                   // No choice. Do what we are told.
                   result = specSize;
                   break;
           }
           return result;
       }

       public void initVideoView() {

           mVideoHeight = 0;
           mVideoWidth = 0;
           setFocusable(false);
           setSurfaceTextureListener(mSurfaceTextureListener);
           mCurrentState = STATE_IDLE;
           mTargetState = STATE_IDLE;

       }

       public void setVideoPath(String path) {
           if (path != null) {
               setVideoURI(Uri.parse(path));
           }
       }

       public void setVideoURI(Uri pVideoURI) {
           mUri = pVideoURI;
           mSeekWhenPrepared = 0;

           MediaMetadataRetriever retriever = new MediaMetadataRetriever();
           retriever.setDataSource(mContext, pVideoURI);

           // create thumbnail bitmap
           if(android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) {
               String rotation = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_ROTATION);

               try {
                   mRotate = Integer.parseInt(rotation);
               } catch(NumberFormatException e) {
                   mRotate = 0;
               }
           }

           retriever.release();

           openVideo();
           requestLayout();
           invalidate();
       }

       public void stopPlayback() {
           if (mMediaPlayer != null) {
               mMediaPlayer.stop();
               mMediaPlayer.release();
               mMediaPlayer = null;
               mCurrentState = STATE_IDLE;
               mTargetState = STATE_IDLE;
           }
       }

       public void openVideo() {
           if ((mUri == null) || (mSurface == null)) {
               // not ready for playback just yet, will try again later
               return;
           }
           // Tell the music playback service to pause
           // TODO: these constants need to be published somewhere in the
           // framework.
           Intent intent = new Intent("com.android.music.musicservicecommand");
           intent.putExtra("command", "pause");
           mContext.sendBroadcast(intent);

           // we shouldn't clear the target state, because somebody might have
           // called start() previously
           release(false);
           try {
               mMediaPlayer = new MediaPlayer();
               // TODO: create SubtitleController in MediaPlayer, but we need
               // a context for the subtitle renderers

               mMediaPlayer.setOnPreparedListener(mPreparedListener);
               mMediaPlayer.setOnVideoSizeChangedListener(mSizeChangedListener);
               mMediaPlayer.setOnCompletionListener(mCompletionListener);
               mMediaPlayer.setOnErrorListener(mErrorListener);
               mMediaPlayer.setOnInfoListener(mInfoListener);
               mMediaPlayer.setOnBufferingUpdateListener(mBufferingUpdateListener);
               mCurrentBufferPercentage = 0;
               mMediaPlayer.setDataSource(mContext, mUri);
               mMediaPlayer.setSurface(mSurface);
               mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);

               mMediaPlayer.setScreenOnWhilePlaying(true);
               mMediaPlayer.prepareAsync();
               mMediaPlayer.setLooping(true);
               mCurrentState = STATE_PREPARING;
           } catch (IllegalStateException e) {
               mCurrentState = STATE_ERROR;
               mTargetState = STATE_ERROR;
               e.printStackTrace();
           } catch (IOException e) {
               mCurrentState = STATE_ERROR;
               mTargetState = STATE_ERROR;
               e.printStackTrace();
           }
       }

       private OnVideoSizeChangedListener mSizeChangedListener = new OnVideoSizeChangedListener() {
           @Override
           public void onVideoSizeChanged(final MediaPlayer mp, final int width,
                                          final int height) {
               mVideoWidth = mp.getVideoWidth();
               mVideoHeight = mp.getVideoHeight();

               if (mVideoWidth != 0 && mVideoHeight != 0) {
                   requestLayout();
                   if(mVideoWidth >= mVideoHeight)
                   initVideo();
               }
           }
       };

       private OnPreparedListener mPreparedListener = new OnPreparedListener() {
           @Override
           public void onPrepared(final MediaPlayer mp) {
               mCurrentState = STATE_PREPARED;

               if (mOnPreparedListener != null) {
                   mOnPreparedListener.onPrepared(mp);
               }

               mVideoWidth = mp.getVideoWidth();
               mVideoHeight = mp.getVideoHeight();

               int seekToPosition = mSeekWhenPrepared; // mSeekWhenPrepared may be
               // changed after seekTo()
               if (seekToPosition != 0) {
                   seekTo(seekToPosition);
               }

               if ((mVideoWidth != 0) && (mVideoHeight != 0)) {
                   if(mVideoWidth >= mVideoHeight) initVideo();

                   if (mTargetState == STATE_PLAYING) {
                       start();
                   }
               } else {
                   // We don't know the video size yet, but should start anyway.
                   // The video size might be reported to us later.
                   if (mTargetState == STATE_PLAYING) {
                       start();
                   }
               }
           }
       };

       private OnCompletionListener mCompletionListener = new OnCompletionListener() {
           @Override
           public void onCompletion(final MediaPlayer mp) {
               mCurrentState = STATE_PLAYBACK_COMPLETED;
               mTargetState = STATE_PLAYBACK_COMPLETED;

               if (mOCompletionListener != null) {
                   mOCompletionListener.onCompletion(mMediaPlayer);
               }
           }
       };

       private OnInfoListener mInfoListener = new OnInfoListener() {
           public boolean onInfo(MediaPlayer mp, int arg1, int arg2) {
               if (mOnInfoListener != null) {
                   mOnInfoListener.onInfo(mp, arg1, arg2);
               }
               return true;
           }
       };

       private OnErrorListener mErrorListener = new OnErrorListener() {
           @Override
           public boolean onError(MediaPlayer mp, int framework_err, int impl_err) {
               Log.d(LOG_TAG, "Error: " + framework_err + "," + impl_err);
               mCurrentState = STATE_ERROR;
               mTargetState = STATE_ERROR;

               /* If an error handler has been supplied, use it and finish. */
               if (mOnErrorListener != null) {
                   if (mOnErrorListener.onError(mMediaPlayer, framework_err,
                           impl_err)) {
                       return true;
                   }
               }
               return true;
           }
       };

       private OnBufferingUpdateListener mBufferingUpdateListener = new OnBufferingUpdateListener() {
           @Override
           public void onBufferingUpdate(final MediaPlayer mp, final int percent) {
               mCurrentBufferPercentage = percent;
           }
       };

       public void setOnPreparedListener(OnPreparedListener listener) {
           mOnPreparedListener = listener;
       }

       public void setOnCompletionListener(OnCompletionListener listener) {
           mOCompletionListener = listener;
       }

       public void setOnErrorListener(OnErrorListener listener) {
           mOnErrorListener = listener;
       }

       public void setOnInfoListener(OnInfoListener listener) {
           mOnInfoListener = listener;
       }

       private void release(boolean cleartargetstate) {
           if (mMediaPlayer != null) {
               mMediaPlayer.reset();
               mMediaPlayer.release();
               mMediaPlayer = null;
               mCurrentState = STATE_IDLE;
               if (cleartargetstate) {
                   mTargetState = STATE_IDLE;
               }
           }
       }

       @Override
       public void start() {
           if (isInPlaybackState()) {
               mMediaPlayer.start();
               mCurrentState = STATE_PLAYING;

           }
           mTargetState = STATE_PLAYING;
       }

       @Override
       public void pause() {
           if (isInPlaybackState()) {
               if (mMediaPlayer.isPlaying()) {
                   mMediaPlayer.pause();
                   mCurrentState = STATE_PAUSED;
               }
           }

           mTargetState = STATE_PAUSED;
       }

       @Override
       public int getDuration() {
           if (isInPlaybackState()) {
               return mMediaPlayer.getDuration();
           }

           return -1;
       }

       @Override
       public int getCurrentPosition() {
           if (isInPlaybackState()) {
               return mMediaPlayer.getCurrentPosition();
           }
           return 0;
       }

       @Override
       public void seekTo(int msec) {
           if (isInPlaybackState()) {
               mMediaPlayer.seekTo(msec);
               mSeekWhenPrepared = 0;
           } else {
               mSeekWhenPrepared = msec;
           }
       }

       @Override
       public boolean isPlaying() {
           return isInPlaybackState() && mMediaPlayer.isPlaying();
       }

       @Override
       public int getBufferPercentage() {
           if (mMediaPlayer != null) {
               return mCurrentBufferPercentage;
           }
           return 0;
       }

       private boolean isInPlaybackState() {
           return (mMediaPlayer != null && mCurrentState != STATE_ERROR
                   && mCurrentState != STATE_IDLE && mCurrentState != STATE_PREPARING);
       }

       @Override
       public boolean canPause() {
           return false;
       }

       @Override
       public boolean canSeekBackward() {
           return false;
       }

       @Override
       public boolean canSeekForward() {
           return false;
       }

       @Override
       public int getAudioSessionId() {
           return -1;
       }

       SurfaceTextureListener mSurfaceTextureListener = new SurfaceTextureListener() {
           @Override
           public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {
               mSurface = new Surface(surface);
               openVideo();
           }

           @Override
           public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) {
               boolean isValidState = (mTargetState == STATE_PLAYING);
               boolean hasValidSize = (mVideoWidth == width && mVideoHeight == height);
               if (mMediaPlayer != null && isValidState && hasValidSize) {
                   start();
               }
           }

           @Override
           public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
               if (mMediaPlayer != null) {
                   mMediaPlayer.reset();
                   mMediaPlayer.release();
                   mMediaPlayer = null;
               }

               if (mSurface != null) {
                   mSurface.release();
                   mSurface = null;
               }

               return true;
           }

           @Override
           public void onSurfaceTextureUpdated(final SurfaceTexture surface) {

           }
       };

       @Override
       protected void onVisibilityChanged(View changedView, int visibility) {
           super.onVisibilityChanged(changedView, visibility);

           if (visibility == View.INVISIBLE || visibility == View.GONE) {
               if (isPlaying()) {
                   stopPlayback();
               }
           }
       }

       public float getScale() {
           return mScale;
       }

       private void initVideo() {
           try {
                   int width = getWidth();
                   int height = getHeight();
                   mScaleX = 1.0f;
                   mScaleY = 1.0f;
                   mPositionX = 0;
                   mPositionY = 0;
                   mBoundX = 0;
                   mBoundY = 0;
                   mMatrix = new Matrix();

                   mScaleX = (float) mVideoWidth / width;
                   mScaleY = (float) mVideoHeight / height;

                   mBoundX = width - mVideoWidth / mScaleY;
                   mBoundY = height - mVideoHeight / mScaleX;

                   if (mScaleX < mScaleY) {
                       mScale = mScaleX;
                       mScaleY = mScaleY * (1.0f / mScaleX);
                       mScaleX = 1.0f;
                       mBoundX = 0;
                   } else {
                       mScale = mScaleY;
                       mScaleX = mScaleX * (1.0f / mScaleY);
                       mScaleY = 1.0f;
                       mBoundY = 0;
                   }

                   mMatrix = new Matrix();
                   mMatrix.setScale(mScaleX, mScaleY);
                   setTransform(mMatrix);
           } catch (NumberFormatException e) {
               e.printStackTrace();
           }
       }

       public void updateViewPosition(float x, float y) {

           float nextX = mPositionX + x;
           float nextY = mPositionY + y;

           if(mScaleX == 1.0f) {
               x = 0;
           } else {
               if(nextX > 0) {
                   x = -mPositionX;
                   mPositionX = mPositionX + x;
               } else if(nextX < mBoundX) {
                   x = mBoundX - mPositionX;
                   mPositionX = mPositionX + x;
               } else {
                   mPositionX = nextX;
               }
           }

           if(mScaleY == 1.0f) {
               y = 0;
           } else {
               if(nextY > 0) {
                   y = -mPositionY;
                   mPositionY = mPositionY + y;
               } else if(nextY < mBoundY) {
                   y = mBoundY - mPositionY;
                   mPositionY = mPositionY + y;
               } else {
                   mPositionY = nextY;
               }
           }

           if(mOnTranslatePositionListener != null) {
               mOnTranslatePositionListener.onTranslatePosition(mPositionX, mPositionY, mPositionX * -mScale, mPositionY * -mScale);
           }

           mMatrix.postTranslate(x, y);
           setTransform(mMatrix);
           invalidate();
       }

    //  public void setOriginalRatio() {
    //      if(mVideoWidth != 0 && mVideoHeight != 0) {
    //          int gcd = gcd(mVideoWidth, mVideoHeight);
    //          setRatio(mVideoWidth / gcd, mVideoHeight / gcd);
    //      }
    //  }

       public int gcd(int n, int m) {
           while (m != 0) {
               int t = n % m;
               n = m;
               m = t;
           }

           return Math.abs(n);
       }

    //  public void setRatio(float ratioWidth, float ratioHeight) {
    //      mRatioWidth = ratioWidth;
    //      mRatioHeight = ratioHeight;
    //
    //      int seek = getCurrentPosition();
    //
    //      requestLayout();
    //      invalidate();
    //      openVideo();
    //
    //      seekTo(seek);
    //  }


       public float getRatioWidth() {
           return mRatioWidth;
       }

       public float getRatioHeight() {
           return mRatioHeight;
       }

       public float getRealPositionX() {
           return mPositionX * -mScale;
       }

       public float getRealPositionY() {
           return mPositionY * -mScale;
       }

       public int getVideoWidth() {
           return mVideoWidth;
       }

       public int getVideoHeight() {
           return mVideoHeight;
       }

       public int getRotate() {
           return mRotate;
       }

       public void setOnTranslatePositionListener(OnTranslatePositionListener pOnTranslatePositionListener) {
           mOnTranslatePositionListener = pOnTranslatePositionListener;
       }

       public void setContext(Context context) {
           this.context = context;
       }

       public interface OnTranslatePositionListener {
           public abstract void onTranslatePosition(float x, float y, float rx, float ry);
       }
    }

    FFMPEG for cropping particular portion

    ffmpeg -i /sdcard/videokit/in.mp4 -filter:v crop=720:1088:0:0 -c:a copy /sdcard/videokit/out.mp4

    public class SimpleExample extends Activity {

       String workFolder = null;
       String demoVideoFolder = null;
       String demoVideoPath = null;
       String vkLogPath = null;
       private boolean commandValidationFailedFlag = false;


       @Override
       public void onCreate(Bundle savedInstanceState) {
           super.onCreate(savedInstanceState);
           setContentView(R.layout.ffmpeg_demo_client_1);

           demoVideoFolder = Environment.getExternalStorageDirectory().getAbsolutePath() + "/videokit/";
           demoVideoPath = demoVideoFolder + "in.mp4";

           Log.i(Prefs.TAG, getString(R.string.app_name) + " version: " + GeneralUtils.getVersionName(getApplicationContext()) );
           workFolder = getApplicationContext().getFilesDir().getAbsolutePath() + "/";
           //Log.i(Prefs.TAG, "workFolder: " + workFolder);
           vkLogPath = workFolder + "vk.log";

           GeneralUtils.copyLicenseFromAssetsToSDIfNeeded(this, workFolder);
           GeneralUtils.copyDemoVideoFromAssetsToSDIfNeeded(this, demoVideoFolder);

           Button invoke =  (Button)findViewById(R.id.invokeButton);
           invoke.setOnClickListener(new OnClickListener() {
               public void onClick(View v){
                   Log.i(Prefs.TAG, "run clicked.");
                   if (GeneralUtils.checkIfFileExistAndNotEmpty(demoVideoPath)) {
                       new TranscdingBackground(SimpleExample.this).execute();
                   }
                   else {
                       Toast.makeText(getApplicationContext(), demoVideoPath + " not found", Toast.LENGTH_LONG).show();
                   }
               }
           });

           int rc = GeneralUtils.isLicenseValid(getApplicationContext(), workFolder);
           Log.i(Prefs.TAG, "License check RC: " + rc);
       }

       public class TranscdingBackground extends AsyncTask
       {

           ProgressDialog progressDialog;
           Activity _act;
           String commandStr;

           public TranscdingBackground (Activity act) {
               _act = act;
           }



           @Override
           protected void onPreExecute() {
               EditText commandText = (EditText)findViewById(R.id.CommandText);
               commandStr = commandText.getText().toString();

               progressDialog = new ProgressDialog(_act);
               progressDialog.setMessage("FFmpeg4Android Transcoding in progress...");
               progressDialog.show();

           }

           protected Integer doInBackground(String... paths) {
               Log.i(Prefs.TAG, "doInBackground started...");

               // delete previous log
               boolean isDeleted = GeneralUtils.deleteFileUtil(workFolder + "/vk.log");
               Log.i(Prefs.TAG, "vk deleted: " + isDeleted);

               PowerManager powerManager = (PowerManager)_act.getSystemService(Activity.POWER_SERVICE);
               WakeLock wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "VK_LOCK");
               Log.d(Prefs.TAG, "Acquire wake lock");
               wakeLock.acquire();

               ///////////// Set Command using code (overriding the UI EditText) /////
               //commandStr = "ffmpeg -y -i /sdcard/videokit/in.mp4 -strict experimental -s 320x240 -r 30 -aspect 3:4 -ab 48000 -ac 2 -ar 22050 -vcodec mpeg4 -b 2097152 /sdcard/videokit/out.mp4";
               //String[] complexCommand = {"ffmpeg", "-y" ,"-i", "/sdcard/videokit/in.mp4","-strict","experimental","-s", "160x120","-r","25", "-vcodec", "mpeg4", "-b", "150k", "-ab","48000", "-ac", "2", "-ar", "22050", "/sdcard/videokit/out.mp4"};
               ///////////////////////////////////////////////////////////////////////


               LoadJNI vk = new LoadJNI();
               try {


                   vk.run(GeneralUtils.utilConvertToComplex(commandStr), workFolder, getApplicationContext());




                   GeneralUtils.copyFileToFolder(vkLogPath, demoVideoFolder);


               } catch (Throwable e) {
                   Log.e(Prefs.TAG, "vk run exeption.", e);
               }
               finally {
                   if (wakeLock.isHeld())
                       wakeLock.release();
                   else{
                       Log.i(Prefs.TAG, "Wake lock is already released, doing nothing");
                   }
               }
               Log.i(Prefs.TAG, "doInBackground finished");
               return Integer.valueOf(0);
           }

           protected void onProgressUpdate(Integer... progress) {
           }

           @Override
           protected void onCancelled() {
               Log.i(Prefs.TAG, "onCancelled");
               //progressDialog.dismiss();
               super.onCancelled();
           }


           @Override
           protected void onPostExecute(Integer result) {
               Log.i(Prefs.TAG, "onPostExecute");
               progressDialog.dismiss();
               super.onPostExecute(result);

               // finished Toast
               String rc = null;
               if (commandValidationFailedFlag) {
                   rc = "Command Vaidation Failed";
               }
               else {
                   rc = GeneralUtils.getReturnCodeFromLog(vkLogPath);
               }
               final String status = rc;
               SimpleExample.this.runOnUiThread(new Runnable() {
                   public void run() {
                       Toast.makeText(SimpleExample.this, status, Toast.LENGTH_LONG).show();
                       if (status.equals("Transcoding Status: Failed")) {
                           Toast.makeText(SimpleExample.this, "Check: " + vkLogPath + " for more information.", Toast.LENGTH_LONG).show();
                       }
                   }
               });
           }

       }


    }