NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

from django.shortcuts import render
from django.http import HttpResponse
from pydub import AudioSegment
from moviepy.editor import *
import os

def index(request):
return render(request, 'index.html')

def process(request):
if request.method == 'POST' and request.FILES['audio'] and request.FILES['image']:
audio_file = request.FILES['audio']
image_file = request.FILES['image']

# Save audio and image files
audio_path = 'media/input_audio.mp3'
image_path = 'media/background_image.jpg'
with open(audio_path, 'wb+') as destination:
for chunk in audio_file.chunks():
destination.write(chunk)
with open(image_path, 'wb+') as destination:
for chunk in image_file.chunks():
destination.write(chunk)

# Select time period of audio and save it
audio = AudioSegment.from_file(audio_path, format="mp3")
start_time = int(request.POST['start_time']) * 1000 # Start time in milliseconds
end_time = int(request.POST['end_time']) * 1000 # End time in milliseconds
selected_audio = audio[start_time:end_time]
selected_audio.export('media/selected_audio.mp3', format='mp3')

# Add image as a background
audio_clip = AudioFileClip('media/selected_audio.mp3')
background_image = ImageClip('media/background_image.jpg')
final_clip = CompositeVideoClip([background_image.set_duration(audio_clip.duration), audio_clip.set_position(('center', 'center'))])

# Set video resolution and export
final_clip = final_clip.set_audio(audio_clip)
output_path = 'media/output_video.mp4'
final_clip.write_videofile(output_path, codec='libx264', audio_codec='aac', temp_audiofile='temp-audio.m4a', remove_temp=True)

# Serve the modified file for download
if os.path.exists(output_path):
with open(output_path, 'rb') as f:
response = HttpResponse(f.read(), content_type='video/mp4')
response['Content-Disposition'] = 'attachment; filename=output_video.mp4'
return response

return HttpResponse("Error processing files.")
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.