
Recherche avancée
Autres articles (93)
-
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains 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 ;
-
Les autorisations surchargées par les plugins
27 avril 2010, parMediaspip core
autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs -
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 (15831)
-
Uploading videos on rails website
16 mai 2017, par DinukapereraI am trying to let my users upload videos on my website(not deployed yet, testing locally). I have it set up in a manner where if the "user information" gets saved, it will take them to the "root_path", which is the homepage. If the user information is not saved, it will render the form again. Before I added the video upload feature, all the information got saved and everything worked well, but after adding the feature, it keeps rendering the same form over and over again since the information is not getting saved. How do I check what’s wrong ? The command line gives me this error :
The user information form partial :
`<%= simple_form_for @userinfo do |f| %>
<%= f.input :name, label: 'Full name', error: 'Full name is mandatory' %>
<%= f.input :username, label: 'Username', error: 'Username is mandatory, please specify one' %>
<%= f.input :school, label: 'Name of college' %>
<%= f.input :gpa, label: 'Enter GPA' %>
<%= f.input :email, label: 'Enter email address' %>
<%= f.input :number, label: 'Phone number' %>
<%= f.file_field :video %>
<%= f.button :submit %>
<% end %>`
My user controller (This is the user information controller, does not control user email and password. I’m using the devise gem for user sign in, sign out, and sign up) :`
class UsersController < ApplicationController
def index
end
def show
end
def new
@userinfo = User.new
end
def create
@userinfo = User.new(user_params)
if @userinfo.save
redirect_to root_path
else
render 'new'
end
end
def edit
end
def update
end
def destroy
end
private
def user_params
params.require(:user).permit(:name, :username, :email, :number, :school, :gpa, :major, :video)
end
end`
This is the user model (usermain is the model related to user password and email. The user information in the user model belongs to the usermain) : `
class User < ActiveRecord::Base
belongs_to :usermain
has_attached_file :video, styles: {:video_show => {:geometry => "640x480",:format => 'mp4'},:video_index => { :geometry => "160x120", :format => 'jpeg', :time => 10}}, :processors => [:transcoder]
validates_attachment_content_type :video, content_type: /\Avideo\/.*\Z/
end`
This is the migration file that creates the user information table :`
class CreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
t.string :name
t.string :username
t.string :email
t.string :number
t.string :school
t.string :gpa
t.string :major
t.timestamps null: false
end
end
endThis is adding the "video" field to the above created user information table:
class AddAttachmentVideoToUsers < ActiveRecord::Migration
def self.up
change_table :users do |t|
t.attachment :video
end
end
def self.down
remove_attachment :users, :video
end
end`
I also have paperclip and ffmpeg installed. When I say installed, it’s literally just that. I’m not sure if I have to manipulate paperclip or ffmpeg in any way to make it work with the videos, I have just installed and did nothing else with them. I have been pulling my hair out for the past two days. Any help is appreciated.
-
Using Pipes for Stream Data in FFMPEG
17 juillet 2024, par Aryan KumarI am trying to input stream and decrease the bitrate of the video without saving it anywhere so i am hoping to pass it as a stream and get the output as a stream and send it to digital ocean spaces to get saved.
But I tried lots of things but my output Stream is getting empty. and the file is empty.


public async Task VideoOperationAsync(Stream inputStream)
 {
 try
 {
 // Ensure the input stream is at the beginning
 inputStream.Position = 0;

 // Create a memory stream to hold the output data
 using (var outputStream = new MemoryStream())
 {
 var arguments = $"-i pipe:0 -f mp4 pipe:1";

 await Cli.Wrap("ffmpeg")
 .WithArguments(arguments)
 .WithStandardInputPipe(PipeSource.FromStream(inputStream))
 .WithStandardOutputPipe(PipeTarget.ToStream(outputStream))
 .WithValidation(CommandResultValidation.None)
 .ExecuteAsync();

 // Ensure the output stream is at the beginning before reading
 outputStream.Position = 0;

 using (var fileStream = new FileStream(@"D:\Gremlin-data\VideoResized\output_cropped.mp4", FileMode.Create, FileAccess.Write))
 {
 await outputStream.CopyToAsync(fileStream);
 }
 }
 }
 catch (Exception ex)
 {
 Console.WriteLine($"An error occurred: {ex.Message}");
 throw; // Re-throw the exception if needed
 }
 }



I also earlier tried this :


public async Task VideoOperationAsync(Stream inputStream)

try

// Ensure the input stream is at the beginning
inputStream.Position = 0 ;


var ffmpegProcess = new Process
 {
 StartInfo = new ProcessStartInfo
 {
 FileName = "ffmpeg", // Ensure ffmpeg is in your PATH or provide the full path
 Arguments = $"-i pipe:0 -b:v 2000k -f mp4 pipe:1", // Correct bitrate format
 RedirectStandardInput = true,
 RedirectStandardOutput = true,
 RedirectStandardError = true, // Capture standard error
 UseShellExecute = false,
 CreateNoWindow = true
 }
 };

 ffmpegProcess.Start();

 // Write input stream to ffmpeg's standard input asynchronously
 Task writingTask = Task.Run(async () =>
 {
 await inputStream.CopyToAsync(ffmpegProcess.StandardInput.BaseStream);
 ffmpegProcess.StandardInput.BaseStream.Close();
 });

 // Read ffmpeg's standard output to a memory stream asynchronously
 using (MemoryStream ms = new MemoryStream())
 {
 Task readingTask = Task.Run(async () =>
 {
 await ffmpegProcess.StandardOutput.BaseStream.CopyToAsync(ms);
 });



-
VP8 Misplaced Plane
16 octobre 2010, par Multimedia Mike — VP8So I’m stubbornly plugging away at my toy VP8 encoder and I managed to produce this gem. See if you can spot the subtle mistake :
The misplaced color plane resulted from using the luma plane stride where it was not appropriate. I fixed that and now chroma planes are wired to use to the same naive prediction algorithm as the luma plane.
Also, I fixed the entropy encoder so that end of block conditions are signaled correctly (instead of my original, suboptimal hack to just encode all zeros). I was disappointed to see that this did not result in a major compression improvement. Then again, I’m using the lowest possible quantization settings for this outing, so perhaps this is to be expected.
Sigh… 4×4 luma prediction is next. Wish me luck.