Recherche avancée

Médias (1)

Mot : - Tags -/MediaSPIP 0.2

Autres articles (46)

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 est la première version de MediaSPIP stable.
    Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • Mise à disposition des fichiers

    14 avril 2011, par

    Par défaut, lors de son initialisation, MediaSPIP ne permet pas aux visiteurs de télécharger les fichiers qu’ils soient originaux ou le résultat de leur transformation ou encodage. Il permet uniquement de les visualiser.
    Cependant, il est possible et facile d’autoriser les visiteurs à avoir accès à ces documents et ce sous différentes formes.
    Tout cela se passe dans la page de configuration du squelette. Il vous faut aller dans l’espace d’administration du canal, et choisir dans la navigation (...)

  • Installation en mode ferme

    4 février 2011, par

    Le mode ferme permet d’héberger plusieurs sites de type MediaSPIP en n’installant qu’une seule fois son noyau fonctionnel.
    C’est la méthode que nous utilisons sur cette même plateforme.
    L’utilisation en mode ferme nécessite de connaïtre un peu le mécanisme de SPIP contrairement à la version standalone qui ne nécessite pas réellement de connaissances spécifique puisque l’espace privé habituel de SPIP n’est plus utilisé.
    Dans un premier temps, vous devez avoir installé les mêmes fichiers que l’installation (...)

Sur d’autres sites (6211)

  • Grand Unified Theory of Compact Disc

    1er février 2013, par Multimedia Mike — General

    This is something I started writing about a decade ago (and I almost certainly have some of it wrong), back when compact discs still had a fair amount of relevance. Back around 2002, after a few years investigating multimedia technology, I took an interest in compact discs of all sorts. Even though there may seem to be a wide range of CD types, I generally found that they’re all fundamentally the same. I thought I would finally publishing something, incomplete though it may be.

    Physical Perspective
    There are a lot of ways to look at a compact disc. First, there’s the physical format, where a laser detects where pits/grooves have disturbed the smooth surface (a.k.a. lands). A lot of technical descriptions claim that these lands and pits on a CD correspond to ones and zeros. That’s not actually true, but you have to decide what level of abstraction you care about, and that abstraction is good enough if you only care about the discs from a software perspective.

    Grand Unified Theory (Software Perspective)
    Looking at a disc from a software perspective, I have generally found it useful to view a CD as a combination of a 2 main components :

    • table of contents (TOC)
    • a long string of sectors, each of which is 2352 bytes long

    I like to believe that’s pretty much all there is to it. All of the information on a CD is stored as a string of sectors that might be chopped up into a series of anywhere from 1-99 individual tracks. The exact sector locations where these individual tracks begin are defined in the TOC.

    Audio CDs (CD-DA / Red Book)
    The initial purpose for the compact disc was to store digital audio. The strange sector size of 2352 bytes is an artifact of this original charter. “CD quality audio”, as any multimedia nerd knows, is formally defined as stereo PCM samples that are each 16 bits wide and played at a frequency of 44100 Hz.

    (44100 audio frames / 1 second) * (2 samples / audio frame) * 
      (16 bits / 1 sample) * (1 byte / 8 bits) = 176,400 bytes / second
    (176,400 bytes / 1 second) / (2352 bytes / 1 sector) = 75
    

    75 is the number of sectors required to store a single second of CD-quality audio. A single sector stores 1/75th of a second, or a ‘frame’ of audio (though I think ‘frame’ gets tossed around at all levels when describing CD formats).

    The term “red book” is thrown around in relation to audio CDs. There is a series of rainbow books that define various optical disc standards and the red book describes audio CDs.

    Basic Data CD-ROMs (Mode 1 / Yellow Book)
    Somewhere along the line, someone decided that general digital information could be stored on these discs. Hence, the CD-ROM was born. The standard model above still applies– TOC and string of 2352-byte sectors. However, it’s generally only useful to have a single track on a CD-ROM. Thus, the TOC only lists a single track. That single track can easily span the entire disc (something that would be unusual for a typical audio CD).

    While the model is mostly the same, the most notable difference between and audio CD and a plain CD-ROM is that, while each sector is 2352 bytes long, only 2048 bytes are used to store actual data payload. The remaining bytes are used for synchronization and additional error detection/correction.

    At least, the foregoing is true for mode 1 / form 1 CD-ROMs (which are the most common). “Mode 1″ CD-ROMs are defined by a publication called the yellow book. There is also mode 1 / form 2. This forgoes the additional error detection and correction afforded by form 1 and dedicates 2336 of the 2352 sector bytes to the data payload.

    CD-ROM XA (Mode 2 / Green Book)
    From a software perspective, these are similar to mode 1 CD-ROMs. There are also 2 forms here. The first form gives a 2048-byte data payload while the second form yields a 2324-byte data payload.

    Video CD (VCD / White Book)
    These are CD-ROM XA discs that carry MPEG-1 video and audio data.

    Photo CD (Beige Book)
    This is something I have never personally dealt with. But it’s supposed to conform to the CD-ROM XA standard and probably fits into my model. It seems to date back to early in the CD-ROM era when CDs were particularly cost prohibitive.

    Multisession CDs (Blue Book)
    Okay, I admit that this confuses me a bit. Multisession discs allow a user to burn multiple sessions to a single recordable disc. I.e., burn a lump of data, then burn another lump at a later time, and the final result will look like all the lumps were recorded as the same big lump. I remember this being incredibly useful and cost effective back when recordable CDs cost around US$10 each (vs. being able to buy a spindle of 100 CD-Rs for US$10 or less now). Studying the cdrom.h file for the Linux OS, I found a system call named CDROMMULTISESSION that returns the sector address of the start of the last session. If I were to hypothesize about how to make this fit into my model, I might guess that the TOC has some hint that the disc was recorded in multisession (which needs to be decided up front) and the CDROMMULTISESSION call is made to find the last session. Or it could be that a disc read initialization operation always leads off with the CDROMMULTISESSION query in order to determine this.

    I suppose I could figure out how to create a multisession disc with modern software, or possibly dig up a multisession disc from 15+ years ago, and then figure out how it should be read.

    CD-i
    This type puzzles my as well. I do have some CD-i discs and I thought that I could read them just fine (the last time I looked, which was many years ago). But my research for this blog post has me thinking that I might not have been seeing the entire picture when I first studied my CD-i samples. I was able to see some of the data, but sources indicate that only proper CD-i hardware is able to see all of the data on the disc (apparently, the TOC doesn’t show all of the sectors on disc).

    Hybrid CDs (Data + Audio)
    At some point, it became a notable selling point for an audio CD to have a data track with bonus features. Even more common (particularly in the early era of CD-ROMs) were computer and console games that used the first track of a disc for all the game code and assets and the remaining tracks for beautifully rendered game audio that could also be enjoyed outside the game. Same model : TOC points to the various tracks and also makes notes about which ones are data and which are audio.

    There seems to be 2 distinct things described above. One type is the mixed mode CD which generally has the data in the first track and the audio in tracks 2..n. Then there is the enhanced CD, which apparently used multisession recording and put the data at the end. I think that the reasoning for this is that most audio CD player hardware would only read tracks from the first session and would have no way to see the data track. This was a positive thing. By contrast, when placing a mixed-mode CD into an audio player, the data track would be rendered as nonsense noise.

    Subchannels
    There’s at least one small detail that my model ignores : subchannels. CDs can encode bits of data in subchannels in sectors. This is used for things like CD-Text and CD-G. I may need to revisit this.

    In Summary
    There’s still a lot of ground to cover, like how those sectors might be formatted to show something useful (e.g., filesystems), and how the model applies to other types of optical discs. Sounds like something for another post.

  • Defining moment of the audio attenuation through ffmpeg

    23 août 2016, par riki-tik

    There are audio tracks of different lengths in m4a format. And there’s ffmpeg library for working with the media. Many of the tracks have the effect of "decay" in the end, and it is necessary to determine at what point it occurs (determined once and the value entered in the database along with other information about the track). Those. we must somehow determine that the track begins to fade, and its volume reached 30% compared to the total volume of the song. Is it possible to solve by means of ffmpeg, and if so, how ?

  • How do I get videos to upload using carrierwave-video ?

    10 juillet 2016, par Eric

    I tried to follow the instructions on github to upload using carrierwave-video, but get an error that says the file or directory mmpeg -i doesn’t exist.

    The upload path for images is correct, just not the video one.

    I added all of the following code necessary to help solve the error and minified as much as I possibly could.

    This is the video uploader code using carrierwave :

    class VideoUploader < CarrierWave::Uploader::Base

     include CarrierWave::Video
     storage :file

     version :mp4 do
       process :encode_video => [:mp4, resolution: "100x100"]
     end

     def store_dir
       "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
     end
    end

    This is the movie controller code that handles uploading of videos :

    class MoviesController < ApplicationController
      include MoviesHelper

      def index
         mode "index"
      end

      def show
         mode "show"
      end

      def new
         mode "new"
      end

      def edit
         mode "edit"
      end

      def create
         mode "create"
      end

      def update
         mode "update"
      end

      def destroy
         mode "destroy"
      end

      def review
         mode "review"
      end

      def approve
         mode "approve"
      end

      def deny
         mode "deny"
      end
    end

    This is the model data for the movie that goes with it :

    class Movie < ActiveRecord::Base
     attr_accessible :created_on, :description, :maintenance, :reviewed, :subplaylist_id, :title, :user_id, :video, :remote_video_url
     belongs_to :user
     belongs_to :subplaylist
     mount_uploader :video, VideoUploader
    end

    This is where the movie is supposed to be displayed but it is not working :

    <% provide(:title, "Movie: Where movies are made!") %>
    <% provide(:keywords, "movies, video") %>
    <% provide(:description, "This is the place where users showcase their wonderful video talent.") %>
    <p>&lt;%= notice %></p>
    <h1 class="pageheader">&lt;%= @movie.title %></h1>
    <br />
    <p class="pagetext">&lt;%= video_tag(@movie.video_url.to_s, controls: true, class: "imagebox") %></p>
    <p class="pagetext">&lt;%= @movie.description %></p>
    <p class="pagetext">Created on: &lt;%= @movie.created_on.strftime("%B-%d-%Y") %></p>
    <p class="pagetext">Owner: &lt;%= getType(@movie.user) %>&lt;%= link_to @movie.user.vname, user_path(@movie.user) %></p>
    <br />
    <p class="pagetext">&lt;%= link_to 'Back', mainplaylist_subplaylist_path(@subplaylist.mainplaylist, @movie.subplaylist) %></p>

    This is where the movie new action is :

    &lt;% provide(:title, "Movie: Create new movies here!") %>
    &lt;% provide(:description, "New movies are uploaded only to the site when the movie gets approved.") %>
    <h1 class="pagetextheader">New movie</h1>
    &lt;%= render 'form' %>
    <p class="pagetext">&lt;%= link_to 'Back', mainplaylist_subplaylist_path(@subplaylist.mainplaylist, @subplaylist) %></p>

    This is where the movies forum parameters are :

    &lt;%= form_for([@subplaylist, @movie], :html=>{:multipart => true}) do |f| %>
     &lt;% if @movie.errors.any? %>
       <div>
         <h2>&lt;%= pluralize(@movie.errors.count, "error") %> prohibited this movie from being saved:</h2>

         <ul>
         &lt;% @movie.errors.full_messages.each do |msg| %>
           <li>&lt;%= msg %></li>
         &lt;% end %>
         </ul>
       </div>
     &lt;% end %>
     <br />
     <div class="pagetext">
       &lt;%= f.label :title %><br />
       &lt;%= f.text_field :title %>
     </div>
     <div class="pagetext">
       &lt;%= f.file_field :video %>
     </div>
     <div class="pagetext">
       &lt;%= f.label :remote_video_url, "or video URL" %><br />
       &lt;%= f.text_field :remote_video_url %>
     </div>
     <div class="pagetext">
       &lt;%= f.label :description %><br />
       &lt;%= f.text_area :description %>
     </div>
     <div class="pagetext">
       &lt;%= f.submit %>
     </div>
     <br />
    &lt;% end %>

    This is the movies helper code :

    module MoviesHelper

      def mode(type)
         code = auto_logout
         if(code == true)
            sign_out
            redirect_to root_path
         else
            #Check if Maintenance is turned_on
            allmode = Maintenancemode.find_by_id(1)
            moviemode = Maintenancemode.find_by_id(19)
            mode_turned_on = (allmode.maintenance_on || moviemode.maintenance_on)
            #Determine if any maintenance is on
            if(mode_turned_on)
               #Determine if we are a regular user
               regularUser = (!current_user || !current_user.admin?)
               if(regularUser)
                  #Determine which maintenance mode is on
                  if(allmode.maintenance_on)
                     redirect_to maintenance_path
                  else
                     redirect_to movies_maintenance_path
                  end
               else
                  switch type
               end
            else
               switch type
            end
         end
      end

      private
         def getType(user)
            if(user.admin)
               value = "$"
            else
               typeFound = Usertype.find_by_user_id(user.id)
               if(typeFound)
                  type = typeFound.privilege
                  if(type == "Reviewer")
                     value = "^"
                  elsif(type == "Banned")
                     value = "!"
                  else
                     value = "~"
                  end
               else
                  value = "~"
               end
            end
            return value
         end

         def movieApproved
            movieFound = Movie.find_by_id(params[:movie_id])
            if(movieFound)
               movieFound.reviewed = true
               pouch = Pouch.find_by_user_id(movieFound.user_id)
               pointsForMovie = 10
               pouch.amount += pointsForMovie
               @pouch = pouch
               @pouch.save
               @movie = movieFound
               @movie.save
    #            MovieMailer.movie_approved(@movie, pointsForMovie).deliver
               redirect_to movies_review_path
            else
               render "public/404"
            end
         end

         def movieDenied
            movieFound = Movie.find_by_id(params[:movie_id])
            if(movieFound)
               #Retrieve the user who owns this pet first
               #userEmail = petFound.user.email
               #Send mail to user with link to edit the pet they sent
               @movie = movieFound
               MovieMailer.movie_denied(@movie).deliver
               redirect_to movies_review_path
            else
               render "public/404"
            end
         end

         def createMovie(subplaylistFound)
            newMovie = subplaylistFound.movies.new
            @subplaylist = subplaylistFound
            @movie = newMovie
         end

         def saveMovie(subplaylistFound, logged_in)
            newMovie = subplaylistFound.movies.new(params[:movie])
            newMovie.user_id = logged_in.id
            currentTime = Time.now
            newMovie.created_on = currentTime
            @movie = newMovie
            if(@movie.save)
               @subplaylist = subplaylistFound
    #            MovieMailer.review_movie(@movie).deliver
               flash[:success] = "#{@movie.title} is currently being reviewed please check back later."
               redirect_to subplaylist_movie_path(@subplaylist, @movie)
            else
               render "new"
            end
         end

         def switch(type)
            if(type == "index") #Admin only
               logged_in = current_user
               if(logged_in)
                  if(logged_in.admin)
                     allMovies = Movies.order("created_on desc").page(params[:page]).per(10)
                     @movies = allMovies
                  else
                     redirect_to root_path
                  end
               else
                  redirect_to root_path
               end
            elsif(type == "show")
               movieFound = Movie.find_by_id(params[:id])
               if(movieFound)
                  subplaylistFound = Subplaylist.find_by_id(params[:subplaylist_id])
                  if(subplaylistFound)
                     if(movieFound.reviewed)
                        @subplaylist = subplaylistFound
                        @movie = movieFound
                     else
                        logged_in = current_user
                        if(logged_in)
                           userMatch = ((logged_in.id == movieFound.user_id) || logged_in.admin)
                           if(userMatch)
                              @subplaylist = subplaylistFound
                              @movie = movieFound
                           else
                              redirect_to root_path
                           end
                        else
                           redirect_to root_path
                        end
                     end
                  else
                     redirect_to root_path
                  end
               else
                  render "public/404"
               end
            elsif(type == "new")
               logged_in = current_user
               if(logged_in)
                  subplaylistFound = Subplaylist.find_by_id(params[:subplaylist_id])
                  if(subplaylistFound)
                     if(subplaylistFound.collab_mode)
                        createMovie(subplaylistFound)
                     else
                        userMatch = (logged_in.id == subplaylistFound.user_id)
                        if(userMatch)
                           createMovie(subplaylistFound)
                        else
                           redirect_to root_path
                        end
                     end
                  else
                     render "public/404"
                  end
               else
                  redirect_to root_path
               end
            elsif(type == "create")
               logged_in = current_user
               if(logged_in)
                  subplaylistFound = Subplaylist.find_by_id(params[:subplaylist_id])
                  if(subplaylistFound)
                     if(subplaylistFound.collab_mode)
                        saveMovie(subplaylistFound, logged_in)
                     else
                        userMatch = (logged_in.id == subplaylistFound.user_id)
                        if(userMatch)
                           saveMovie(subplaylistFound, logged_in)
                        else
                           redirect_to root_path
                        end
                     end
                  else
                     render "public/404"
                  end
               else
                  redirect_to root_path
               end
            elsif(type == "edit")
               logged_in = current_user
               if(logged_in)
                  movieFound = Movie.find_by_id(params[:id])
                  if(movieFound)
                     userMatch = (logged_in.id == movieFound.user_id)
                     if(userMatch)
                        subplaylistFound = Subplaylist.find_by_id(movieFound.subplaylist_id)
                        if(subplaylistFound)
                           @subplaylist = subplaylistFound
                           @movie = movieFound
                        else
                           render "public/404"
                        end
                     else
                        redirect_to root_path
                     end
                  else
                     render "public/404"
                  end
               else
                  redirect_to root_path
               end
            elsif(type == "update")
               logged_in = current_user
               if(logged_in)
                  movieFound = Movie.find_by_id(params[:id])
                  if(movieFound)
                     userMatch = (logged_in.id == movieFound.user_id)
                     if(userMatch)
                        subplaylistFound = Subplaylist.find_by_id(movieFound.subplaylist_id)
                        if(subplaylistFound)
                           @movie = movieFound
                           if(@movie.update_attributes(params[:movie]))
                              @subplaylist = subplaylistFound
                              flash[:success] = 'Movie was successfully updated.'
                              redirect_to subplaylist_movie_path(@subplaylist, @movie)
                           else
                              render "edit"
                           end
                        else
                           render "public/404"
                        end
                     else
                        redirect_to root_path
                     end
                  else
                     render "public/404"
                  end
               else
                  redirect_to root_path
               end
            elsif(type == "destroy")
               logged_in = current_user
               if(logged_in)
                  movieFound = Movie.find_by_id(params[:id]) #Need to move this below the admin section to protect it
                  if(movieFound)
                     if(logged_in.admin)
                        subplaylistFound = Subplaylist.find_by_id(movieFound.subplaylist_id)
                        if(subplaylistFound)
                           @movie = movieFound
                           @subplaylist = subplaylistFound
                           @movie.destroy
                           redirect_to mainplaylist_subplaylist_path(@subplaylist.mainplaylist, @subplaylist)
                        else
                           render "public/404"
                        end
                     else
                        redirect_to root_path
                     end
                  else
                     render "public/404"
                  end
               else
                  redirect_to root_path
               end
            elsif(type == "review") #Admin
               logged_in = current_user
               if(logged_in)
                  if(logged_in.admin)
                     allMovies = Movie.all
                     moviesToReview = allMovies.select{|movie| !movie.reviewed}
                     @movies = Kaminari.paginate_array(moviesToReview).page(params[:page]).per(10)
                  else
                     typeFound = Usertype.find_by_user_id(logged_in.id)
                     if(typeFound.privilege == "Reviewer")
                        allMovies = Movie.all
                        moviesToReview = allMovies.select{|movie| !movie.reviewed}
                        @movies = Kaminari.paginate_array(moviesToReview).page(params[:page]).per(10)
                     else
                        redirect_to root_path
                     end
                  end
               else
                  redirect_to root_path
               end
            elsif(type == "approve") #Admin
               logged_in = current_user
               if(logged_in)
                  if(logged_in.admin)
                     movieApproved
                  else
                     typeFound = Usertype.find_by_user_id(logged_in.id)
                     if(typeFound.privilege == "Reviewer")
                        movieApproved
                     else
                        redirect_to root_path
                     end
                  end
               else
                  redirect_to root_path
               end
            elsif(type == "deny") #Admin
               logged_in = current_user
               if(logged_in)
                  if(logged_in.admin)
                     movieDenied
                  else
                     typeFound = Usertype.find_by_user_id(logged_in.id)
                     if(typeFound.privilege == "Reviewer")
                        movieDenied
                     else
                        redirect_to root_path
                     end
                  end
               else
                  redirect_to root_path
               end
            end
         end
    end

    This is the subplaylists show code :

    &lt;% provide(:title, "Subplaylist: The place where users videos gets uploaded to!") %>
    &lt;% provide(:keywords, "user, video, uploaded") %>
    &lt;% provide(:description, "Allows the categorization of various videos that the user submitted successfully.") %>
    <p>&lt;%= notice %></p>
    <h1 class="pageheader">&lt;%= @subplaylist.title %></h1>
    <br />
    <p class="pagetext">&lt;%= @subplaylist.description %></p>
    <br />
    <div class="pagebox">&lt;%= paginate @movies %></div>





    <br />
    <div class="pagetext">
      &lt;% @movies.each_with_index do |movie, index| %>
         <div class="container">
            <div class="inner">
               <div class="inner">&lt;%= link_to movie.title, subplaylist_movie_path(@subplaylist, movie) %></div>
               &lt;% if current_user &amp;&amp; (current_user.id == movie.user_id || current_user.admin? )%>
                  <div class="inner">&lt;%= button_to 'Edit', edit_subplaylist_movie_path(@subplaylist, movie), method: :get %></div>
                  <div class="inner">&lt;%= button_to 'Destroy', [@subplaylist, movie], method: :delete, data: { confirm: 'Are you sure?' } %></div>
               &lt;% end %>
               <p>&lt;%= video_tag movie.video_url(:thumb).to_s, controls: true %></p>
            </div>
            <br />
            <p>Created on: &lt;%= movie.created_on.strftime("%B-%d-%Y") %></p>
            <p>Owner: &lt;%= getType(movie.user) %>&lt;%= link_to movie.user.vname, user_path(movie.user) %></p>
         </div>
         &lt;% if ((index + 1) % 3) == 0 %>
            <br />
            <br />
         &lt;% end %>
      &lt;% end %>
    </div>
    <br />
    &lt;% if current_user %>
      <p class="pagetext">&lt;%= link_to "New Movie", new_subplaylist_movie_path(@subplaylist) %></p>
      <br />
    &lt;% end %>
    <p class="pagetext">&lt;%= link_to 'Back', user_mainplaylist_path(@mainplaylist.user.vname, @subplaylist.mainplaylist.title) %></p>

    This is the subplaylists model :

    class Subplaylist &lt; ActiveRecord::Base
      attr_accessible :title, :description, :collab_mode
      belongs_to :user
      belongs_to :mainplaylist
      has_many :movies, :foreign_key => "subplaylist_id", :dependent => :destroy
      VALID_NAME = /\A[A-Za-z][A-Za-z1-9][A-Za-z1-9 ]+\z/
      validates :title, presence: true, format: {with: VALID_NAME}
      validates :description, presence: true
    end

    This is the subplaylists controller code :

    class SubplaylistsController &lt; ApplicationController
      include SubplaylistsHelper

      def index
         mode "index"
      end

      def show
         mode "show"
      end

      def new
         mode "new"
      end

      def edit
         mode "edit"
      end

      def create
         mode "create"
      end

      def update
         mode "update"
      end

      def destroy
         mode "destroy"
      end
    end

    This is the subplaylist helper code :

    module SubplaylistsHelper

      def mode(type)
         code = auto_logout
         if(code == true)
            sign_out
            redirect_to root_path
         else
            #Check if Maintenance is turned_on
            allmode = Maintenancemode.find_by_id(1)
            subplaylistmode = Maintenancemode.find_by_id(18)
            mode_turned_on = (allmode.maintenance_on || subplaylistmode.maintenance_on)
            #Determine if any maintenance is on
            if(mode_turned_on)
               #Determine if we are a regular user
               regularUser = (!current_user || !current_user.admin?)
               if(regularUser)
                  #Determine which maintenance mode is on
                  if(allmode.maintenance_on)
                     redirect_to maintenance_path
                  else
                     redirect_to subplaylists_maintenance_path
                  end
               else
                  switch type
               end
            else
               switch type
            end
         end
      end

      private
         def getType(user)
            if(user.admin)
               value = "$"
            else
               typeFound = Usertype.find_by_user_id(user.id)
               if(typeFound)
                  type = typeFound.privilege
                  if(type == "Reviewer")
                     value = "^"
                  elsif(type == "Banned")
                     value = "!"
                  else
                     value = "~"
                  end
               else
                  value = "~"
               end
            end
            return value
         end

         def switch(type)
            if(type == "show")
               subplaylistFound = Subplaylist.find_by_id(params[:id])
               if(subplaylistFound)
                  mainplaylistFound = Mainplaylist.find_by_title(params[:mainplaylist_id])
                  if(mainplaylistFound)
                     playlistMatch = (subplaylistFound.mainplaylist_id == mainplaylistFound.id)
                     if(playlistMatch)
                        @mainplaylist = mainplaylistFound
                        @subplaylist = subplaylistFound
                        subplaylistMovies = @subplaylist.movies.all
                        reviewedMovies = subplaylistMovies
                        if(subplaylistMovies.count > 0)
                           reviewedMovies = subplaylistMovies.select{|movie| movie.reviewed}
                        end
                        @movies = Kaminari.paginate_array(reviewedMovies).page(params[:page]).per(10)
                     else
                        redirect_to root_path
                     end
                  else
                     render "public/404"
                  end
               else
                  redirect_to root_path
               end
            elsif(type == "destroy")
               logged_in = current_user
               if(logged_in)
                  subplaylistFound = Subplaylist.find_by_id(params[:id]) #Need to move this below the admin section to protect it
                  if(subplaylistFound)
                     if(logged_in.admin)
                        mainplaylistFound = Mainplaylist.find_by_id(subplaylistFound.mainplaylist_id)
                        if(mainplaylistFound)
                           @subplaylist = subplaylistFound
                           @mainplaylist = mainplaylistFound
                           @subplaylist.destroy
                           redirect_to mainplaylist_subplaylists_path(@mainplaylist)
                        else
                           render "public/404"
                        end
                     else
                        redirect_to root_path
                     end
                  else
                     render "public/404"
                  end
               else
                  redirect_to root_path
               end
            end
         end
    end

    This is the User model :

    class User &lt; ActiveRecord::Base
      attr_accessible :email, :first_name, :last_name, :login_id, :vname, :password, :password_confirmation, :avatar
      has_secure_password
      mount_uploader :avatar, AvatarUploader
      before_save { |user| user.email = user.email.downcase }
      before_save { |user| user.first_name = user.first_name.humanize }

      #key
      has_one :sessionkey, :foreign_key => "user_id", :dependent => :destroy
      has_one :usertype, :foreign_key => "user_id", :dependent => :destroy

      #Video section
      has_many :mainplaylists, :foreign_key => "user_id", :dependent => :destroy
      has_many :subplaylists, :foreign_key => "user_id", :dependent => :destroy
      has_many :movies, :foreign_key => "user_id", :dependent => :destroy

      #validates :first_name, presence: true
      VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
      VALID_NAME_REGEX = /\A[a-z][a-z][a-z]+\z/i
      VALID_VNAME_REGEX = /\A[A-Za-z][A-Za-z][A-Za-z][A-Za-z0-9 ]+([-][A-Za-z0-9 ]+)?\z/
      VALID_PASSWORD_REGEX = /\A[A-Za-z0-9!][A-Za-z0-9!][A-Za-z0-9!][A-Za-z0-9!][A-Za-z0-9!][A-Za-z0-9!]+\z/
      validates :first_name, presence: true, format: { with: VALID_NAME_REGEX}
      validates :last_name, presence: true, format: { with: VALID_NAME_REGEX}
      validates :email, presence: true, format: { with: VALID_EMAIL_REGEX}
      validates :login_id, presence: true, format: { with: VALID_VNAME_REGEX}, uniqueness: { case_sensitive: false}
      validates :vname, presence: true, format: { with: VALID_VNAME_REGEX}, uniqueness: { case_sensitive: false}
      validates :password, length: {minimum: 6}#, format: { with: VALID_PASSWORD_REGEX}
      validates :password_confirmation, presence: true #, format: { with: VALID_PASSWORD_REGEX}

      def to_param
         vname
      end
    end

    This is the sessionkey model :

    class Sessionkey &lt; ActiveRecord::Base
     belongs_to :user
    end

    This is the usertype model :

    class Usertype &lt; ActiveRecord::Base
     attr_accessible :privilege, :user_id #Only priviledge will be changeable
     belongs_to :user
    end

    This is the error message :

    No such file or directory - ffmpeg -i /home/eric/Projects/Local/Lduelingpets/Trial/public/uploads/tmp/1466811951-3149-2702/mp4_TrialMovies.mp4