Recherche avancée

Médias (1)

Mot : - Tags -/ogg

Autres articles (25)

  • La file d’attente de SPIPmotion

    28 novembre 2010, par

    Une file d’attente stockée dans la base de donnée
    Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
    Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...)

  • List of compatible distributions

    26 avril 2011, par

    The table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
    If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...)

  • Contribute to documentation

    13 avril 2011

    Documentation is vital to the development of improved technical capabilities.
    MediaSPIP welcomes documentation by users as well as developers - including : critique of existing features and functions articles contributed by developers, administrators, content producers and editors screenshots to illustrate the above translations of existing documentation into other languages
    To contribute, register to the project users’ mailing (...)

Sur d’autres sites (3560)

  • ffmpeg live stream to website html5

    31 août 2013, par roastbeef

    what I want to do is use a webcam or screen capture and broadcast to my site. Ive heard about apple's http streaming but i'm not interested because it's support seems limited. Can someone guide me into the right direction ? I would live to use html5 video. thanks

  • How can i create a portrait video using Android's MediaRecorder

    23 mars 2015, par urudroid

    I have an Android application which is able to record and play a videos in portrait mode, those features are working fine on Android phones.

    The issue comes up because this video is needed to be played also on iOS devices (after being shared through a server).

    iOS is not correctly showing the video as it looks "cropped", but videos recorded on iOS are played without issues.

    So, the main difference between videos created on Android and iOS’ is the size and the rotation.

    Im using CWAC-Camera library for preview and recording and ffmpeg to scale the video down to 320x568px (as this is the standard size for both Android and iOS apps).

    Here is the metadata from an video created from Android :

    General
    Complete name                            : android_video.mp4
    Format                                   : MPEG-4
    Format profile                           : Base Media
    Codec ID                                 : isom
    File size                                : 447 KiB
    Duration                                 : 5s 596ms
    Overall bit rate                         : 654 Kbps
    Encoded date                             : UTC 1904-01-01 00:00:00
    Tagged date                              : UTC 1904-01-01 00:00:00
    Writing application                      : Lavf56.4.101

    Video
    ID                                       : 1
    Format                                   : AVC
    Format/Info                              : Advanced Video Codec
    Format profile                           : High@L2.1
    Format settings, CABAC                   : Yes
    Format settings, ReFrames                : 4 frames
    Codec ID                                 : avc1
    Codec ID/Info                            : Advanced Video Coding
    Duration                                 : 5s 406ms
    Bit rate                                 : 536 Kbps
    Width                                    : 568 pixels
    Height                                   : 320 pixels
    Display aspect ratio                     : 16:9
    Original display aspect ratio            : 16:9
    Rotation                                 : 270°
    Frame rate mode                          : Constant
    Frame rate                               : 14.985 fps
    Color space                              : YUV
    Chroma subsampling                       : 4:2:0
    Bit depth                                : 8 bits
    Scan type                                : Progressive
    Bits/(Pixel*Frame)                       : 0.197
    Stream size                              : 354 KiB (79%)
    Writing library                          : x264 core 142
    Encoding settings                        : 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=14 / 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
    Language                                 : English
    Encoded date                             : UTC 1904-01-01 00:00:00
    Tagged date                              : UTC 1904-01-01 00:00:00

    Audio
    ID                                       : 2
    Format                                   : AAC
    Format/Info                              : Advanced Audio Codec
    Format profile                           : LC
    Codec ID                                 : 40
    Duration                                 : 5s 596ms
    Bit rate mode                            : Constant
    Bit rate                                 : 132 Kbps
    Channel(s)                               : 2 channels
    Channel(s)_Original                      : 1 channel
    Channel positions                        : Front: C
    Sampling rate                            : 44.1 KHz
    Compression mode                         : Lossy
    Stream size                              : 89.4 KiB (20%)
    Language                                 : English
    Encoded date                             : UTC 1904-01-01 00:00:00
    Tagged date                              : UTC 1904-01-01 00:00:00

    And here is the metadata from the video created on iOS :

    General
    Complete name                            : ios_video.mp4
    Format                                   : MPEG-4
    Format profile                           : Base Media / Version 2
    Codec ID                                 : mp42
    File size                                : 673 KiB
    Duration                                 : 7s 38ms
    Overall bit rate                         : 783 Kbps
    Encoded date                             : UTC 2015-03-17 19:16:36
    Tagged date                              : UTC 2015-03-17 19:16:37

    Video
    ID                                       : 2
    Format                                   : AVC
    Format/Info                              : Advanced Video Codec
    Format profile                           : Main@L3.0
    Format settings, CABAC                   : Yes
    Format settings, ReFrames                : 2 frames
    Codec ID                                 : avc1
    Codec ID/Info                            : Advanced Video Coding
    Duration                                 : 7s 33ms
    Bit rate                                 : 711 Kbps
    Width                                    : 320 pixels
    Height                                   : 568 pixels
    Display aspect ratio                     : 0.563
    Frame rate mode                          : Constant
    Frame rate                               : 30.000 fps
    Color space                              : YUV
    Chroma subsampling                       : 4:2:0
    Bit depth                                : 8 bits
    Scan type                                : Progressive
    Bits/(Pixel*Frame)                       : 0.130
    Stream size                              : 610 KiB (91%)
    Title                                    : Core Media Video
    Encoded date                             : UTC 2015-03-17 19:16:36
    Tagged date                              : UTC 2015-03-17 19:16:37
    Color primaries                          : BT.709
    Transfer characteristics                 : BT.709
    Matrix coefficients                      : BT.709
    Color range                              : Limited

    Audio
    ID                                       : 1
    Format                                   : AAC
    Format/Info                              : Advanced Audio Codec
    Format profile                           : LC
    Codec ID                                 : 40
    Duration                                 : 7s 38ms
    Source duration                          : 7s 105ms
    Bit rate mode                            : Constant
    Bit rate                                 : 64.0 Kbps
    Channel(s)                               : 2 channels
    Channel(s)_Original                      : 1 channel
    Channel positions                        : Front: C
    Sampling rate                            : 44.1 KHz
    Compression mode                         : Lossy
    Stream size                              : 56.8 KiB (8%)
    Source stream size                       : 57.2 KiB (9%)
    Title                                    : Core Media Audio
    Encoded date                             : UTC 2015-03-17 19:16:36
    Tagged date                              : UTC 2015-03-17 19:16:37

    The values width and height are inverted on Android, also the Rotation parameter is set to 270º (this is the rotation parameter for portrait videos).

    This is a sketch of how iOS’ videos look on iOS app :

    Videos recorded on iOS

    And this is how Android’s videos look on iOS app :

    enter image description here

    So, in order to get the videos correctly displayed both on iOS and Android i need to be able to set the width to 320 and height to 568 on Android. I tried it from several places (outside and inside CWAC-Camera library) but i always get a Camera.Parameters error.

    It is possible to do this on Android ?

    EDIT :

    This is the result i get when i set the rotation to 0 with ffmpeg :

    enter image description here

  • How to Turn image A + audio + A into Video A with the exact same attributes of Video B so both can be concatenated without encoding [closed]

    13 décembre 2024, par Furkan Gözükara

    I have image A and it is PNG

    


    I have audio A and it is MP3

    


    I have video B that can be any format, resolution, encoding, audio, etc

    


    Now I want to turn image A + audio A into video A with the exact attributes of video B so that I can concatenate them without encoding

    


    Here my so far code which is failing. I am using Python and latest version of FFMPEG with most codecs and features

    


    def get_video_info(video_path):
    cmd = [
        FFPROBE_PATH,
        '-v', 'quiet',
        '-print_format', 'json',
        '-show_format',
        '-show_streams',
        video_path
    ]
    result = subprocess.run(cmd, capture_output=True, text=True)
    info = json.loads(result.stdout)
    
    video_stream = next((s for s in info['streams'] if s['codec_type'] == 'video'), None)
    audio_stream = next((s for s in info['streams'] if s['codec_type'] == 'audio'), None)
    
    if not video_stream or not audio_stream:
        logging.error("Failed to find video or audio stream")
        return None

    return {
        'width': int(video_stream.get('width', 0)),
        'height': int(video_stream.get('height', 0)),
        'fps': eval(video_stream.get('r_frame_rate', '30/1')),
        'video_codec': video_stream.get('codec_name', ''),
        'audio_codec': audio_stream.get('codec_name', ''),
        'audio_sample_rate': int(audio_stream.get('sample_rate', 0)),
        'audio_channels': audio_stream.get('channels', 0),
        'pixel_format': video_stream.get('pix_fmt', ''),
        'color_space': video_stream.get('color_space', ''),
        'color_transfer': video_stream.get('color_transfer', ''),
        'color_primaries': video_stream.get('color_primaries', ''),
    }

def create_thumbnail_video(thumbnail_url, video_id, video_info, duration=40):
    output_dir = os.path.abspath('downloads')
    output_path = os.path.join(output_dir, f"{video_id}_thumbnail.mp4")
    audio_path = os.path.abspath("a.mp3")

    try:
        # 1. Download and process the image
        logging.info("Downloading thumbnail image...")
        response = requests.get(thumbnail_url, timeout=30)
        response.raise_for_status()

        # Save the original image
        original_image_path = os.path.join(output_dir, f'{video_id}_original_image.png')
        with open(original_image_path, 'wb') as f:
            f.write(response.content)

        # 2. Open and resize the image
        image = Image.open(original_image_path)
        width, height = video_info['width'], video_info['height']
        image = image.resize((width, height), Image.LANCZOS)

        # Save resized image
        resized_image_path = os.path.join(output_dir, f'{video_id}_resized_image.png')
        image.save(resized_image_path, 'PNG')

        # 3. Get properties of the main video using ffprobe
        main_video_path = os.path.join(output_dir, f"{video_id}.mp4")  # Assuming main video has .mp4 extension
        main_video_info = get_video_info(main_video_path)

        if not main_video_info:
            raise Exception("Could not get information about the main video.")

        # 4. Generate video with matching encoding
        logging.info("Generating thumbnail video with matching codec and properties...")

        ffmpeg_command = [
            FFMPEG_PATH,
            '-y',
            '-loop', '1',
            '-i', resized_image_path,
            '-i', audio_path,
            '-c:v', main_video_info['video_codec'],
            '-c:a', main_video_info['audio_codec'],
            '-ar', str(main_video_info['audio_sample_rate']),
            '-pix_fmt', main_video_info['pixel_format'],
            '-color_range', main_video_info.get('color_range', '1'),  # Default to tv/mpeg (limited) if not found
            '-colorspace', main_video_info['color_space'],
            '-color_trc', main_video_info['color_transfer'],
            '-color_primaries', main_video_info['color_primaries'],
            '-vf', f"fps={main_video_info['fps']},scale={width}:{height}",
            '-shortest',
            '-t', str(duration),
            output_path
        ]

        subprocess.run(ffmpeg_command, check=True, capture_output=True, text=True)
        logging.info(f"Thumbnail video created: {output_path}")

        # 5. Clean up intermediate files
        for file_path in [original_image_path, resized_image_path]:
            if os.path.exists(file_path):
                os.remove(file_path)
                logging.info(f"Removed intermediate file: {file_path}")

        return output_path

    except requests.RequestException as e:
        logging.error(f"Error downloading thumbnail: {e}")
    except subprocess.CalledProcessError as e:
        logging.error(f"FFmpeg error: {e.stderr}")
    except Exception as e:
        logging.error(f"Error in create_thumbnail_video: {e}")
        logging.error(traceback.format_exc())

    # If we've reached this point, an error occurred
    logging.warning("Thumbnail video creation failed. Returning None.")
    return None


    


    Here example case

    


    Generated video from image + audio as below

    


    General
Complete name                  : C:\stream\downloads\hqDA0-waGwI_thumbnail.mp4
Format                         : MPEG-4
Format profile                 : Base Media
Codec ID                       : isom (isom/iso2/avc1/mp41)
File size                      : 1.50 MiB
Duration                       : 40 s 0 ms
Overall bit rate mode          : Variable
Overall bit rate               : 315 kb/s
Frame rate                     : 30.000 FPS
Writing application            : Lavf61.9.100

Video
ID                             : 1
Format                         : AVC
Format/Info                    : Advanced Video Codec
Format profile                 : High@L4
Format settings                : CABAC / 4 Ref Frames
Format settings, CABAC         : Yes
Format settings, Reference fra : 4 frames
Codec ID                       : avc1
Codec ID/Info                  : Advanced Video Coding
Duration                       : 40 s 0 ms
Bit rate                       : 179 kb/s
Width                          : 1 920 pixels
Height                         : 1 080 pixels
Display aspect ratio           : 16:9
Frame rate mode                : Constant
Frame rate                     : 30.000 FPS
Color space                    : YUV
Chroma subsampling             : 4:2:0
Bit depth                      : 8 bits
Scan type                      : Progressive
Bits/(Pixel*Frame)             : 0.003
Stream size                    : 875 KiB (57%)
Writing library                : x264 core 164
Encoding settings              : 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=34 / lookahead_threads=5 / 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=25 / 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
Color range                    : Limited
Matrix coefficients            : BT.709
Codec configuration box        : avcC

Audio
ID                             : 2
Format                         : AAC LC
Format/Info                    : Advanced Audio Codec Low Complexity
Codec ID                       : mp4a-40-2
Duration                       : 40 s 0 ms
Source duration                : 40 s 23 ms
Source_Duration_LastFrame      : -8 ms
Bit rate mode                  : Variable
Bit rate                       : 128 kb/s
Channel(s)                     : 2 channels
Channel layout                 : L R
Sampling rate                  : 44.1 kHz
Frame rate                     : 43.066 FPS (1024 SPF)
Compression mode               : Lossy
Stream size                    : 621 KiB (40%)
Source stream size             : 621 KiB (40%)
Default                        : Yes
Alternate group                : 1


    


    Source video used to get video attributes

    


    General
Complete name                  : C:\stream\downloads\hqDA0-waGwI.mp4
Format                         : MPEG-4
Format profile                 : Base Media
Codec ID                       : isom (isom/iso2/avc1/mp41)
File size                      : 24.9 MiB
Duration                       : 1 min 36 s
Overall bit rate               : 2 171 kb/s
Frame rate                     : 30.000 FPS
Writing application            : Lavf61.9.100

Video
ID                             : 1
Format                         : AVC
Format/Info                    : Advanced Video Codec
Format profile                 : High@L4
Format settings                : CABAC / 3 Ref Frames
Format settings, CABAC         : Yes
Format settings, Reference fra : 3 frames
Codec ID                       : avc1
Codec ID/Info                  : Advanced Video Coding
Duration                       : 1 min 36 s
Bit rate                       : 2 036 kb/s
Width                          : 1 920 pixels
Height                         : 1 080 pixels
Display aspect ratio           : 16:9
Frame rate mode                : Constant
Frame rate                     : 30.000 FPS
Color space                    : YUV
Chroma subsampling             : 4:2:0
Bit depth                      : 8 bits
Scan type                      : Progressive
Bits/(Pixel*Frame)             : 0.033
Stream size                    : 23.3 MiB (94%)
Title                          : ISO Media file produced by Google Inc.
Color range                    : Limited
Color primaries                : BT.709
Transfer characteristics       : BT.709
Matrix coefficients            : BT.709
Codec configuration box        : avcC

Audio
ID                             : 2
Format                         : AAC LC
Format/Info                    : Advanced Audio Codec Low Complexity
Codec ID                       : mp4a-40-2
Duration                       : 1 min 36 s
Bit rate mode                  : Constant
Bit rate                       : 128 kb/s
Channel(s)                     : 2 channels
Channel layout                 : L R
Sampling rate                  : 44.1 kHz
Frame rate                     : 43.066 FPS (1024 SPF)
Compression mode               : Lossy
Stream size                    : 1.47 MiB (6%)
Title                          : ISO Media file produced by Google Inc.
Language                       : English
Default                        : Yes
Alternate group                : 1