Recherche avancée

Médias (1)

Mot : - Tags -/artwork

Autres articles (89)

  • Organiser par catégorie

    17 mai 2013, par

    Dans MédiaSPIP, une rubrique a 2 noms : catégorie et rubrique.
    Les différents documents stockés dans MédiaSPIP peuvent être rangés dans différentes catégories. On peut créer une catégorie en cliquant sur "publier une catégorie" dans le menu publier en haut à droite ( après authentification ). Une catégorie peut être rangée dans une autre catégorie aussi ce qui fait qu’on peut construire une arborescence de catégories.
    Lors de la publication prochaine d’un document, la nouvelle catégorie créée sera proposée (...)

  • Récupération d’informations sur le site maître à l’installation d’une instance

    26 novembre 2010, par

    Utilité
    Sur le site principal, une instance de mutualisation est définie par plusieurs choses : Les données dans la table spip_mutus ; Son logo ; Son auteur principal (id_admin dans la table spip_mutus correspondant à un id_auteur de la table spip_auteurs)qui sera le seul à pouvoir créer définitivement l’instance de mutualisation ;
    Il peut donc être tout à fait judicieux de vouloir récupérer certaines de ces informations afin de compléter l’installation d’une instance pour, par exemple : récupérer le (...)

  • Personnaliser les catégories

    21 juin 2013, par

    Formulaire de création d’une catégorie
    Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
    Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
    On peut modifier ce formulaire dans la partie :
    Administration > Configuration des masques de formulaire.
    Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
    Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...)

Sur d’autres sites (10292)

  • Can I convert a django video upload from a form using ffmpeg before storing the video ?

    5 mai 2014, par GetItDone

    I’ve been stuck for weeks trying to use ffmpeg to convert user uploaded videos to flv. I use heroku to host my website, and store my static and media files on amazon S3 with s3boto. The initial video file will upload fine, however when I retrieve the video and run a celery task (in the same view where the initial video file is uploaded), the new file won’t store on S3. I’ve been trying to get this to work for over a month, with no luck, and really no good resources available for learning how to do this, so I figure maybe if I can get the ffmpeg task to run before storing the video I may be able to get it to work. Unfortunately I’m still not a very advanced at python (or django), so I don’t even know if/how this is possible. Anyone have any ideas ? I am willing to use any solution at this point no matter how ugly, as long as it successfully takes video uploads and converts to flv using ffmpeg, with the resulting file being stored on S3. It doesn’t seem that my situation is very common, because no matter where I look, I cannot find a solution that explains what I should be trying to do. Therefore I will be very appreciative of any guidance. Thanks. My relevant code follows :

    #models.py
    def content_file_name(instance, filename):
       ext = filename.split('.')[-1]
       new_file_name = "remove%s.%s" % (uuid.uuid4(), ext)
       return '/'.join(['videos', instance.teacher.username, new_file_name])

    class BroadcastUpload(models.Model):
       title = models.CharField(max_length=50, verbose_name=_('Title'))
       description = models.TextField(max_length=100, verbose_name=_('Description'))
       teacher = models.ForeignKey(User, null=True, blank=True, related_name='teacher')
       created_date = models.DateTimeField(auto_now_add=True)
       video_upload = models.FileField(upload_to=content_file_name)
       flvfilename = models.CharField(max_length=100, null=True, blank=True)
       videothumbnail = models.CharField(max_length=100, null=True, blank=True)

    #tasks.py
    @task(name='celeryfiles.tasks.convert_flv')
    def convert_flv(video_id):
       video = BroadcastUpload.objects.get(pk=video_id)
       print "ID: %s" % video.id
       id = video.id
       print "VIDEO NAME: %s" % video.video_upload.name
       teacher = video.teacher
       print "TEACHER: %s" % teacher
       filename = video.video_upload
       sourcefile = "%s%s" % (settings.MEDIA_URL, filename)
       vidfilename = "%s_%s.flv" % (teacher, video.id)
       targetfile = "%svideos/flv/%s" % (settings.MEDIA_URL, vidfilename)
       ffmpeg = "ffmpeg -i %s %s" % (sourcefile, vidfilename)
       try:
           ffmpegresult = subprocess.call(ffmpeg)
           #also tried separately with following line:
           #ffmpegresult = commands.getoutput(ffmpeg)
           print "---------------FFMPEG---------------"
           print "FFMPEGRESULT: %s" % ffmpegresult
       except Exception as e:
           ffmpegresult = None
           print("Failed to convert video file %s to %s" % (sourcefile, targetfile))
           print(traceback.format_exc())
       video.flvfilename = vidfilename
       video.save()

    @task(name='celeryfiles.tasks.ffmpeg_image')        
    def ffmpeg_image(video_id):
       video = BroadcastUpload.objects.get(pk=video_id)
       print "ID: %s" %video.id
       id = video.id
       print "VIDEO NAME: %s" % video.video_upload.name
       teacher = video.teacher
       print "TEACHER: %s" % teacher
       filename = video.video_upload
       sourcefile = "%s%s" % (settings.MEDIA_URL, filename)
       imagefilename = "%s_%s.png" % (teacher, video.id)
       thumbnailfilename = "%svideos/flv/%s" % (settings.MEDIA_URL, thumbnailfilename)
       grabimage = "ffmpeg -y -i %s -vframes 1 -ss 00:00:02 -an -vcodec png -f rawvideo -s 320x240 %s" % (sourcefile, thumbnailfilename)
       try:        
            videothumbnail = subprocess.call(grabimage)
            #also tried separately following line:
            #videothumbnail = commands.getoutput(grabimage)
            print "---------------IMAGE---------------"
            print "VIDEOTHUMBNAIL: %s" % videothumbnail
       except Exception as e:
            videothumbnail = None
            print("Failed to convert video file %s to %s" % (sourcefile, thumbnailfilename))
            print(traceback.format_exc())
       video.videothumbnail = imagefilename
       video.save()

    #views.py
    def upload_broadcast(request):
       if request.method == 'POST':
           form = BroadcastUploadForm(request.POST, request.FILES)
           if form.is_valid():
               upload=form.save()
               video_id = upload.id
               image_grab = ffmpeg_image.delay(video_id)
               video_conversion = convert_flv.delay(video_id)
               return HttpResponseRedirect('/current_classes/')
       else:
           form = BroadcastUploadForm(initial={'teacher': request.user,})
       return render_to_response('videos/create_video.html', {'form': form,}, context_instance=RequestContext(request))

    #settings.py
    DEFAULT_FILE_STORAGE = 'myapp.s3utils.MediaRootS3BotoStorage'
    DEFAULT_S3_PATH = "media"
    STATICFILES_STORAGE = 'myapp.s3utils.StaticRootS3BotoStorage'
    STATIC_S3_PATH = "static"
    AWS_STORAGE_BUCKET_NAME = 'my_bucket'
    CLOUDFRONT_DOMAIN = 'domain.cloudfront.net'
    AWS_ACCESS_KEY_ID = 'MY_KEY_ID'
    AWS_SECRET_ACCESS_KEY = 'MY_SECRET_KEY'
    MEDIA_ROOT = '/%s/' % DEFAULT_S3_PATH
    MEDIA_URL = 'http://%s/%s/' % (CLOUDFRONT_DOMAIN, DEFAULT_S3_PATH)
    ...

    #s3utils.py
    from storages.backends.s3boto import S3BotoStorage
    from django.utils.functional import SimpleLazyObject

    StaticRootS3BotoStorage = lambda: S3BotoStorage(location='static')
    MediaRootS3BotoStorage  = lambda: S3BotoStorage(location='media')

    I can add any other info if needed to help me solve my problem.

  • Unresolved symbols when linking ffmpeg 2.7.1 on OSX 10.10.4/amd64 with Xcode 6.4

    9 juillet 2015, par Corey Brenner

    I am seeing a problem linking against ffmpeg 2.7.1 (as installed by homebrew just today). Though the libraries in question are referenced on the command line, and though the linker admits to pulling in the correct libraries, and though the libraries themselves have the desired symbols (verified with NM), the symbols I need from the ffmpeg libraries do not show up.

    My host and target platform is Mac x86_64, Xcode 6.4, OS X v10.10.4.

    ("ERROR (LINK.dll) : " is from my build system)

    Thanks in advance !

    ERROR (LINK.dll): /usr/bin/clang -dynamiclib -single_module -install_name @loader_path/ourapp_ffmpeg_test.5.0.0.dylib -compatibility_version 5.0.0 -current_version 5.0.0 -v -Wl,-t -arch x86_64 -mmacosx-version-min=10.7 -g -o "/Users/myname/src/oursdk/devel/main/out/mac/x86-64/system/debug/obj/source/ourapp/decoders/ourapp_ffmpeg_test/dll/shared/ourapp_ffmpeg_test.5.0.0.dylib" /Users/myname/src/oursdk/devel/main/out/mac/x86-64/system/debug/obj/source/ourapp/decoders/ourapp_ffmpeg_test/pic/main.o /Users/myname/src/oursdk/devel/main/out/mac/x86-64/system/debug/obj/source/ourbaselib/lib/pic/libourbaselib.a -L"/usr/local/lib" -lavformat -lavcodec -lswscale -lavutil -framework IOKit -framework CoreServices -liconv -lstdc++
    ERROR (LINK.dll): Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
    ERROR (LINK.dll): Target: x86_64-apple-darwin14.4.0
    ERROR (LINK.dll): Thread model: posix
    ERROR (LINK.dll):  "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -dylib -dylib_compatibility_version 5.0.0 -dylib_current_version 5.0.0 -arch x86_64 -dylib_install_name @loader_path/ourapp_ffmpeg_test.5.0.0.dylib -macosx_version_min 10.7.0 -single_module -o /Users/myname/src/oursdk/devel/main/out/mac/x86-64/system/debug/obj/source/ourapp/decoders/ourapp_ffmpeg_test/dll/shared/ourapp_ffmpeg_test.5.0.0.dylib -L/usr/local/lib -t /Users/myname/src/oursdk/devel/main/out/mac/x86-64/system/debug/obj/source/ourapp/decoders/ourapp_ffmpeg_test/pic/main.o /Users/myname/src/oursdk/devel/main/out/mac/x86-64/system/debug/obj/source/ourbaselib/lib/pic/libourbaselib.a -lavformat -lavcodec -lswscale -lavutil -framework IOKit -framework CoreServices -liconv -lstdc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.1.0/lib/darwin/libclang_rt.osx.a
    ERROR (LINK.dll): Undefined symbols for architecture x86_64:
    ERROR (LINK.dll):   "av_frame_free(AVFrame**)", referenced from:
    ERROR (LINK.dll):       ourapp_ffmpeg_shutdown(ourapp_ffmpeg_handle_s*) in main.o
    ERROR (LINK.dll):   "av_read_frame(AVFormatContext*, AVPacket*)", referenced from:
    ERROR (LINK.dll):       ourapp_ffmpeg_frame_get(ourapp_ffmpeg_handle_s*, AVFrame**, int*, int*) in main.o
    ERROR (LINK.dll):   "avcodec_close(AVCodecContext*)", referenced from:
    ERROR (LINK.dll):       ourapp_ffmpeg_shutdown(ourapp_ffmpeg_handle_s*) in main.o
    ERROR (LINK.dll):   "avcodec_open2(AVCodecContext*, AVCodec const*, AVDictionary**)", referenced from:
    ERROR (LINK.dll):       ourapp_ffmpeg_decode_init(char const*, ourapp_ffmpeg_handle_s*) in main.o
    ERROR (LINK.dll):   "av_dump_format(AVFormatContext*, int, char const*, int)", referenced from:
    ERROR (LINK.dll):       ourapp_ffmpeg_decode_init(char const*, ourapp_ffmpeg_handle_s*) in main.o
    ERROR (LINK.dll):   "av_frame_alloc()", referenced from:
    ERROR (LINK.dll):       ourapp_ffmpeg_decode_init(char const*, ourapp_ffmpeg_handle_s*) in main.o
    ERROR (LINK.dll):   "av_free_packet(AVPacket*)", referenced from:
    ERROR (LINK.dll):       ourapp_ffmpeg_frame_get(ourapp_ffmpeg_handle_s*, AVFrame**, int*, int*) in main.o
    ERROR (LINK.dll):   "avpicture_fill(AVPicture*, unsigned char const*, AVPixelFormat, int, int)", referenced from:
    ERROR (LINK.dll):       ourapp_ffmpeg_decode_init(char const*, ourapp_ffmpeg_handle_s*) in main.o
    ERROR (LINK.dll):   "av_register_all()", referenced from:
    ERROR (LINK.dll):       ourapp_ffmpeg_init() in main.o
    ERROR (LINK.dll):   "avpicture_get_size(AVPixelFormat, int, int)", referenced from:
    ERROR (LINK.dll):       ourapp_ffmpeg_decode_init(char const*, ourapp_ffmpeg_handle_s*) in main.o
    ERROR (LINK.dll):   "avformat_open_input(AVFormatContext**, char const*, AVInputFormat*, AVDictionary**)", referenced from:
    ERROR (LINK.dll):       ourapp_ffmpeg_decode_init(char const*, ourapp_ffmpeg_handle_s*) in main.o
    ERROR (LINK.dll):   "avcodec_copy_context(AVCodecContext*, AVCodecContext const*)", referenced from:
    ERROR (LINK.dll):       ourapp_ffmpeg_decode_init(char const*, ourapp_ffmpeg_handle_s*) in main.o
    ERROR (LINK.dll):   "avcodec_find_decoder(AVCodecID)", referenced from:
    ERROR (LINK.dll):       ourapp_ffmpeg_decode_init(char const*, ourapp_ffmpeg_handle_s*) in main.o
    ERROR (LINK.dll):   "avformat_close_input(AVFormatContext**)", referenced from:
    ERROR (LINK.dll):       ourapp_ffmpeg_shutdown(ourapp_ffmpeg_handle_s*) in main.o
    ERROR (LINK.dll):   "sws_getCachedContext(SwsContext*, int, int, AVPixelFormat, int, int, AVPixelFormat, int, SwsFilter*, SwsFilter*, double const*)", referenced from:
    ERROR (LINK.dll):       get_scalecontext(SwsContext**, AVStream const*, int, int, AVPixelFormat) in main.o
    ERROR (LINK.dll):   "avcodec_decode_video2(AVCodecContext*, AVFrame*, int*, AVPacket const*)", referenced from:
    ERROR (LINK.dll):       ourapp_ffmpeg_frame_get(ourapp_ffmpeg_handle_s*, AVFrame**, int*, int*) in main.o
    ERROR (LINK.dll):   "avcodec_alloc_context3(AVCodec const*)", referenced from:
    ERROR (LINK.dll):       ourapp_ffmpeg_decode_init(char const*, ourapp_ffmpeg_handle_s*) in main.o
    ERROR (LINK.dll):   "sws_getColorspaceDetails(SwsContext*, int**, int*, int**, int*, int*, int*, int*)", referenced from:
    ERROR (LINK.dll):       get_scalecontext(SwsContext**, AVStream const*, int, int, AVPixelFormat) in main.o
    ERROR (LINK.dll):   "sws_setColorspaceDetails(SwsContext*, int const*, int, int const*, int, int, int, int)", referenced from:
    ERROR (LINK.dll):       get_scalecontext(SwsContext**, AVStream const*, int, int, AVPixelFormat) in main.o
    ERROR (LINK.dll):   "avformat_find_stream_info(AVFormatContext*, AVDictionary**)", referenced from:
    ERROR (LINK.dll):       ourapp_ffmpeg_decode_init(char const*, ourapp_ffmpeg_handle_s*) in main.o
    ERROR (LINK.dll):   "av_free(void*)", referenced from:
    ERROR (LINK.dll):       ourapp_ffmpeg_shutdown(ourapp_ffmpeg_handle_s*) in main.o
    ERROR (LINK.dll):   "av_malloc(unsigned long)", referenced from:
    ERROR (LINK.dll):       ourapp_ffmpeg_decode_init(char const*, ourapp_ffmpeg_handle_s*) in main.o
    ERROR (LINK.dll):   "sws_scale(SwsContext*, unsigned char const* const*, int const*, int, int, unsigned char* const*, int const*)", referenced from:
    ERROR (LINK.dll):       ourapp_ffmpeg_frame_get(ourapp_ffmpeg_handle_s*, AVFrame**, int*, int*) in main.o
    ERROR (LINK.dll): ld: symbol(s) not found for architecture x86_64
    ERROR (LINK.dll): /Users/myname/src/oursdk/devel/main/out/mac/x86-64/system/debug/obj/source/ourapp/decoders/ourapp_ffmpeg_test/pic/main.o
    ERROR (LINK.dll): /usr/local/lib/libavformat.dylib
    ERROR (LINK.dll): /usr/local/lib/libavcodec.dylib
    ERROR (LINK.dll): /usr/local/lib/libswscale.dylib
    ERROR (LINK.dll): /usr/local/lib/libavutil.dylib
    ERROR (LINK.dll): /System/Library/Frameworks//IOKit.framework/IOKit
    ERROR (LINK.dll): /System/Library/Frameworks//CoreServices.framework/CoreServices
    ERROR (LINK.dll): /usr/lib/libiconv.dylib
    ERROR (LINK.dll): /usr/lib/libSystem.dylib
    ERROR (LINK.dll): /usr/lib/libstdc++.dylib
    ERROR (LINK.dll): /System/Library/Frameworks//CFNetwork.framework/CFNetwork
    ERROR (LINK.dll): /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/FSEvents.framework/Versions/A/FSEvents
    ERROR (LINK.dll): /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/CarbonCore
    ERROR (LINK.dll): /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/Metadata.framework/Versions/A/Metadata
    ERROR (LINK.dll): /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/OSServices.framework/Versions/A/OSServices
    ERROR (LINK.dll): /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/SearchKit.framework/Versions/A/SearchKit
    ERROR (LINK.dll): /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation
    ERROR (LINK.dll): /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/AE.framework/Versions/A/AE
    ERROR (LINK.dll): /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/LaunchServices
    ERROR (LINK.dll): /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/DictionaryServices.framework/Versions/A/DictionaryServices
    ERROR (LINK.dll): /usr/lib/system/libcache.dylib
    ERROR (LINK.dll): /usr/lib/system/libcommonCrypto.dylib
    ERROR (LINK.dll): /usr/lib/system/libcompiler_rt.dylib
    ERROR (LINK.dll): /usr/lib/system/libcopyfile.dylib
    ERROR (LINK.dll): /usr/lib/system/libcorecrypto.dylib
    ERROR (LINK.dll): /usr/lib/system/libdispatch.dylib
    ERROR (LINK.dll): /usr/lib/system/libdyld.dylib
    ERROR (LINK.dll): /usr/lib/system/libkeymgr.dylib
    ERROR (LINK.dll): /usr/lib/system/liblaunch.dylib
    ERROR (LINK.dll): /usr/lib/system/libmacho.dylib
    ERROR (LINK.dll): /usr/lib/system/libquarantine.dylib
    ERROR (LINK.dll): /usr/lib/system/libremovefile.dylib
    ERROR (LINK.dll): /usr/lib/system/libsystem_asl.dylib
    ERROR (LINK.dll): /usr/lib/system/libsystem_blocks.dylib
    ERROR (LINK.dll): /usr/lib/system/libsystem_c.dylib
    ERROR (LINK.dll): /usr/lib/system/libsystem_configuration.dylib
    ERROR (LINK.dll): /usr/lib/system/libsystem_coreservices.dylib
    ERROR (LINK.dll): /usr/lib/system/libsystem_coretls.dylib
    ERROR (LINK.dll): /usr/lib/system/libsystem_dnssd.dylib
    ERROR (LINK.dll): /usr/lib/system/libsystem_info.dylib
    ERROR (LINK.dll): /usr/lib/system/libsystem_kernel.dylib
    ERROR (LINK.dll): /usr/lib/system/libsystem_m.dylib
    ERROR (LINK.dll): /usr/lib/system/libsystem_malloc.dylib
    ERROR (LINK.dll): /usr/lib/system/libsystem_network.dylib
    ERROR (LINK.dll): /usr/lib/system/libsystem_networkextension.dylib
    ERROR (LINK.dll): /usr/lib/system/libsystem_notify.dylib
    ERROR (LINK.dll): /usr/lib/system/libsystem_platform.dylib
    ERROR (LINK.dll): /usr/lib/system/libsystem_pthread.dylib
    ERROR (LINK.dll): /usr/lib/system/libsystem_sandbox.dylib
    ERROR (LINK.dll): /usr/lib/system/libsystem_secinit.dylib
    ERROR (LINK.dll): /usr/lib/system/libsystem_stats.dylib
    ERROR (LINK.dll): /usr/lib/system/libsystem_trace.dylib
    ERROR (LINK.dll): /usr/lib/system/libunc.dylib
    ERROR (LINK.dll): /usr/lib/system/libunwind.dylib
    ERROR (LINK.dll): /usr/lib/system/libxpc.dylib
    ERROR (LINK.dll): /Users/myname/src/oursdk/devel/main/out/mac/x86-64/system/debug/obj/source/ourbaselib/lib/pic/libourbaselib.a(ourbaselib_memory.o)
    ERROR (LINK.dll): /Users/myname/src/oursdk/devel/main/out/mac/x86-64/system/debug/obj/source/ourbaselib/lib/pic/libourbaselib.a(ourbaselib_atomic.o)
    ERROR (LINK.dll): /Users/myname/src/oursdk/devel/main/out/mac/x86-64/system/debug/obj/source/ourbaselib/lib/pic/libourbaselib.a(ourbaselib_stacktrace.o)
    ERROR (LINK.dll): clang: error: linker command failed with exit code 1 (use -v to see invocation)
  • django upload and convert and save

    31 août 2015, par hessam zaheri

    I have a form in django that I upload an avi movie and I want to convert to mp4 and save in media root and save path in database record :

    class Content(models.Model):
       content_title_en = models.CharField(max_length=255)
       content_movie = models.FileField(verbose_name='movie')

       def save(self, *args, **kwargs):
           if self.content_movie:
               os.popen("ffmpeg -i C:/new/Wildlife.wmv video.mp4")
           super(Content, self).save(*args, **kwargs)

    and I convert file but I don’t know how save in file and my database record.