Recherche avancée

Médias (1)

Mot : - Tags -/ogv

Autres articles (49)

  • Les vidéos

    21 avril 2011, par

    Comme les documents de type "audio", Mediaspip affiche dans la mesure du possible les vidéos grâce à la balise html5 .
    Un des inconvénients de cette balise est qu’elle n’est pas reconnue correctement par certains navigateurs (Internet Explorer pour ne pas le nommer) et que chaque navigateur ne gère en natif que certains formats de vidéos.
    Son avantage principal quant à lui est de bénéficier de la prise en charge native de vidéos dans les navigateur et donc de se passer de l’utilisation de Flash et (...)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-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

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

Sur d’autres sites (8150)

  • Add watermark in video with Google Cloud function python

    26 septembre 2020, par Dharmeshsharma

    I am adding watermark in uploaded video by http google cloud function but my code is return on ffmpeg non zero. my python code

    


    import os
from google.cloud import storage
from subprocess import check_output
from videoprops import get_video_properties


def hello_world(request):

client = storage.Client()
bucket = client.get_bucket('bucket_name')
request_json = request.get_json()
req_data = request.get_json()
name = req_data['file']
videofile_name = req_data['file_name']
os.makedirs('/tmp/'+os.path.dirname(name), exist_ok=True)
file_name = '/tmp/' + name
output_file_name = '/tmp/' + name.split('.')[0] + '_.'+name.split('.')[1]
print(output_file_name)
logo_path = '/temp/watermark.png'
logo_name = 'watermark.png'
print('logo found')

print(file_name)

try:
    os.remove(file_name)
except OSError:
    pass

try:
    os.remove(logo_path)
except OSError:
    pass

print("File has been removed")

# Downloading the video to the cloud functions
blob = bucket.get_blob(name)
blob.download_to_filename(file_name)

blob_logo = bucket.get_blob(logo_name)
blob_logo.download_to_filename(logo_path)

print("Video Downloaded")

props = get_video_properties(file_name)

if os.path.exists(file_name):
    print("NEW MP4 EXISTS")
    #   check_output('ffmpeg  -itsoffset -4  -i '+file_name+' -vcodec mjpeg -vframes 1 -an -f rawvideo -s '+str(props['width'])+'x'+str(props['height'])+' '+thumbnail_file_name, shell=True)
    #   thumbnail_blob = bucket.blob(os.path.dirname(name)+'/thumbnail.jpg')
    #   thumbnail_blob.upload_from_filename(thumbnail_file_name)
    # 19-7-2020
    check_output('ffmpeg  -i '+file_name+' -i '+logo_path +
                 ' -filter_complex overlay=10:10 -codec:a copy -preset ultrafast -async 1 '+output_file_name, shell=True)
    thumbnail_blob = bucket.blob(
        os.path.dirname(name) + '/'+videofile_name)
    thumbnail_blob.upload_from_filename(output_file_name)
    # -------------------------------------
else:
    print("MP4 not created")

print("uploaded")


    


    In this code accessing video add watermark also accessing from bucket and applying with ffmpeg and uploading.

    


    error is :-

    


    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError : Command 'ffmpeg -i /tmp/Upload/Video/1060/ad69ec74-49db-4fdb-b118-d23b9468a7b8.mp4 -i /temp/watermark.png -filter_complex overlay=10:10 -codec:a copy -preset ultrafast -async 1 /tmp/Upload/Video/1060/ad69ec74-49db-4fdb-b118-d23b9468a7b8_.mp4' returned non-zero exit status 1.

    


  • Ffmpeg invalid data when trying to merge videos

    30 juillet 2020, par Luka Milivojevic

    I have a below function for merging videos in Python without re-encoding using FFmpeg :

    


    def merge():
    """
    This function merges a group of videos into one long video.
    It is used for merging parts that are cut from original video into a new one.
    The videos are merged using ffmpeg and for the ffmpeg
    to use the concat method on them, the video names must be put inside
    the vidlist.txt file.
    New video is saved to the file named output.mp4.
    """
    command = "ffmpeg -hide_banner -loglevel error -f concat -safe 0 -i vidlist.txt -c copy output.mp4"
    # merge multiple parts of the video
    subprocess.call(command, shell=True)


    


    I store paths to videos to be merged inside a vidlist.txt file which looks like :

    


    file 'out11.mp4'
file 'out21.mp4'


    


    But, I am getting the following error :

    


    vidlist.txt: Invalid data found when processing input


    


    Here is the report file :

    


    ffmpeg started on 2020-07-30 at 20:23:53
Report written to "ffmpeg-20200730-202353.log"
Log level: 48
Command line:
ffmpeg -hide_banner -f concat -safe 0 -i "C:\\Users\\miliv\\videocutter\\utils\\vidlist.txt" -c copy output.mp4 -report
Splitting the commandline.
Reading option '-hide_banner' ... matched as option 'hide_banner' (do not show program banner) with argument '1'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'concat'.
Reading option '-safe' ... matched as AVOption 'safe' with argument '0'.
Reading option '-i' ... matched as input url with argument 'C:\Users\miliv\videocutter\utils\vidlist.txt'.
Reading option '-c' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option 'output.mp4' ... matched as output url.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option hide_banner (do not show program banner) with argument 1.
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url C:\Users\miliv\videocutter\utils\vidlist.txt.
Applying option f (force format) with argument concat.
Successfully parsed a group of options.
Opening an input file: C:\Users\miliv\videocutter\utils\vidlist.txt.
[concat @ 000001aaafb8e400] Opening 'C:\Users\miliv\videocutter\utils\vidlist.txt' for reading
[file @ 000001aaafb8f500] Setting default whitelist 'file,crypto,data'
[AVIOContext @ 000001aaafb97700] Statistics: 0 bytes read, 0 seeks
C:\Users\miliv\videocutter\utils\vidlist.txt: Invalid data found when processing input


    


  • Convert videos in ffmpeg filter_complex with different timebases to use xfade

    28 juillet 2020, par sil

    I'd like to use ffmpeg's new xfade filter to crossfade between two videos. In theory this is easy :

    


    ffmpeg -i v1.mp4 -i v2.mp4 \
  -filter_complex "[0][1]xfade=duration=1:offset=5,format=yuv420p" \
  out.mp4


    


    However, this fails with the error :

    


    First input link main timebase (1/1500) do not match the corresponding second input link xfade timebase (1/30000)

    


    Obviously these two videos do have different timebases. This is confirmed by the ffmpeg output :

    


    Stream #0:0(eng): Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), yuv444p, 1280x720 [SAR 1:1 DAR 16:9], 536 kb/s, 15 fps, 15 tbr, 1500 tbn, 30 tbc (default)
...
Stream #1:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709/unknown/bt709), 1280x720 [SAR 1:1 DAR 16:9], 1117 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)


    


    I don't want to convert each video and save the results and then combine the two new temporary disk files. Is it possible to use -filter_complex to convert the videos before xfade so that they have the same timebase ? So that I can run one command which takes any two videos and crossfades between them ?

    


    Attempting to set the timebase explicitly with the settb filter seems to work at first but then gets "stuck" on frame 3 and never makes any more progress :

    


    $ ffmpeg -i v1.mp4 -i v2.mp4 -filter_complex "[0]settb=1/AVTB[v0];[1]settb=1/AVTB[v1];[v0][v1]xfade=duration=1:offset=5,format=yuv420p" out.mp4
ffmpeg version N-53546-g5eb4405fc5-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 8 (Debian 8.3.0-6)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg
  libavutil      56. 56.100 / 56. 56.100
  libavcodec     58. 97.100 / 58. 97.100
  libavformat    58. 49.100 / 58. 49.100
  libavdevice    58. 11.101 / 58. 11.101
  libavfilter     7. 87.100 /  7. 87.100
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
  libpostproc    55.  8.100 / 55.  8.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'v1.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42mp41isomiso2
    creation_time   : 2014-08-20T20:47:56.000000Z
    encoder         : x264
  Duration: 00:00:12.67, start: 0.000000, bitrate: 538 kb/s
    Stream #0:0(eng): Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), yuv444p, 1280x720 [SAR 1:1 DAR 16:9], 536 kb/s, 15 fps, 15 tbr, 1500 tbn, 30 tbc (default)
    Metadata:
      creation_time   : 2014-08-20T20:47:56.000000Z
      handler_name    : VideoHandler
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'v2.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.83.100
  Duration: 00:00:04.31, start: 0.000000, bitrate: 1286 kb/s
    Stream #1:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709/unknown/bt709), 1280x720 [SAR 1:1 DAR 16:9], 1117 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #1:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 159 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
File 'out.mp4' already exists. Overwrite? [y/N] y
Stream mapping:
  Stream #0:0 (h264) -> settb (graph 0)
  Stream #1:0 (h264) -> settb (graph 0)
  format (graph 0) -> Stream #0:0 (libx264)
  Stream #1:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0x69aaac0] using SAR=1/1
[libx264 @ 0x69aaac0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x69aaac0] profile High, level 3.1, 4:2:0, 8-bit
[libx264 @ 0x69aaac0] 264 - core 161 r3018 db0d417 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=15 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'out.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42mp41isomiso2
    encoder         : Lavf58.49.100
    Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 15 fps, 15360 tbn, 15 tbc (default)
    Metadata:
      encoder         : Lavc58.97.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      encoder         : Lavc58.97.100 aac
frame=    3 fps=0.0 q=0.0 size=       0kB time=00:00:02.94 bitrate=   0.1kbits/s
frame=    3 fps=3.0 q=0.0 size=       0kB time=00:00:04.24 bitrate=   0.1kbits/s
frame=    3 fps=2.0 q=0.0 size=       0kB time=00:00:04.24 bitrate=   0.1kbits/s
frame=    3 fps=1.5 q=0.0 size=       0kB time=00:00:04.24 bitrate=   0.1kbits/s
(and repeat this line forever)