Recherche avancée

Médias (91)

Autres articles (52)

  • 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

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

  • Support audio et vidéo HTML5

    10 avril 2011

    MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
    Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
    Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
    Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)

Sur d’autres sites (7203)

  • errors while building ffmpeg with ndk16b standalone toolchain

    11 octobre 2018, par soni sahu

    I am trying to build ffmpeg with android ndk18b toolchain. My configuration looks like this.

    TOOLCHAIN_PREFIX=/home/git/ndks/stand_alone_toolchain_ndk16b
    NDK_SYSROOT=$TOOLCHAIN_PREFIX/sysroot
    NDK_ARCH='arm'
    NDK_ABIARCH='arm-linux-androideabi'
    target_host=arm-linux-androideabi
    export CPP="${CROSS_PREFIX}clang++"
    export PATH=${TOOLCHAIN_PREFIX}/bin:$PATH
    export CROSS_PREFIX=${TOOLCHAIN_PREFIX}/bin/${NDK_ABIARCH}-
    export CC="${CROSS_PREFIX}clang"
    export CXX="${CROSS_PREFIX}clang++"
    export AS="${CROSS_PREFIX}clang"
    export AR="${CROSS_PREFIX}ar"
    export LD="${CROSS_PREFIX}ld"
    export RANLIB="${CROSS_PREFIX}ranlib"
    export STRIP="${CROSS_PREFIX}strip"
    export OBJDUMP="${CROSS_PREFIX}objdump"
    export CPP="${CROSS_PREFIX}cpp"
    export GCONV="${CROSS_PREFIX}gconv"
    export NM="${CROSS_PREFIX}nm"
    export SIZE="${CROSS_PREFIX}size"

    # Tell configure what flags Android requires.
    export CFLAGS="-fPIE -fPIC"
    export LDFLAGS="-pie"

    ./configure \
       --cpu="armv7-a" \
       --enable-pic \
       --disable-runtime-cpudetect \
       --enable-pthreads \
       --enable-hardcoded-tables \
       --prefix=$PREFIX \
       --disable-doc \
       --disable-ffplay \
       --disable-ffprobe \
       --disable-ffserver \
       --disable-doc \
       --disable-network \
       --enable-libmp3lame \
       --enable-libx264 \
       --enable-gpl \
       --extra-ldflags="-latomic -L${NDK_SYSROOT}/usr/lib -L$TOOLCHAIN_PREFIX/arm-linux-androideabi/lib -L$TOOLCHAIN_PREFIX/lib -Llibmp3lame/lib -Lx264/android/armeabi-v7a/lib $LDFLAGS -v -lc -lm -ldl -llog -march=armv7-a"\
       --extra-cflags="-ffast-math -funroll-loops -mfloat-abi=softfp -mfpu=vfpv3-d16 -Ilibmp3lame/include -Ix264/android/armeabi-v7a/include $CFLAGS -march=armv7-a -marm -mfloat-abi=softfp -mfpu=neon -mtune=cortex-a8 -mthumb -D__thumb__ -fno-exceptions -fno-rtti -march=armv7-a -Wl,--fix-cortex-a8" \
       --arch=arm\
       --target-os=linux \
       --enable-cross-compile \
       --cross-prefix=$TOOLCHAIN_PREFIX/bin/arm-linux-androideabi- \
       --nm=${NM} \
       --cc=${CC} \
       --cxx=${CXX} \
       --ld=${LD} \
       --ar=${AR} \
       --as=${AS} \
       --strip=${STRIP}

    I have build libmp3lame using this http://developer.samsung.com/android/technical-docs/Porting-and-using-LAME-MP3-on-Android-with-JNI and placed inside libmp3lame/lib folder.

    I am getting these undefined errors in config.log.

    /home/git/ndks/stand_alone_toolchain_ndk18b/bin/arm-linux-androideabi-clang
    -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Dstrtod=avpriv_strtod -DPIC -fPIE -fPIC -ffast-math -funroll-loops -mfloat-abi=softfp -mfpu=vfpv3-d16 -Ilibmp3lame/include -Ix264/android/armeabi-v7a/include -fPIE -fPIC -march=armv7-a -marm -mfloat-abi=softfp -mfpu=neon -mtune=cortex-a8 -mthumb -D__thumb__ -fno-exceptions -fno-rtti -march=armv7-a -Wl,—fix-cortex-a8 -march=armv7-a -std=c11 -fomit-frame-pointer -fPIC -mthumb -c -o /tmp/ffconf.PT1BY4UI.o /tmp/ffconf.5z69vrhC.c clang70 : warning :
    -Wl,—fix-cortex-a8 : ’linker’ input unused [-Wunused-command-line-argument]
    /home/git/ndks/stand_alone_toolchain_ndk18b/bin/arm-linux-androideabi-ld
    -pie -latomic -L/home/git/ndks/stand_alone_toolchain_ndk18b/sysroot/usr/lib -L/home/git/ndks/stand_alone_toolchain_ndk18b/arm-linux-androideabi/lib
    -L/home/git/ndks/stand_alone_toolchain_ndk18b/lib -Llibmp3lame/lib -Lx264/android/armeabi-v7a/lib -pie -v -lc -lm -ldl -llog -march=armv7-a -o /tmp/ffconf.o9IsP7bS /tmp/ffconf.PT1BY4UI.o -lmp3lame -lm -lz libmp3lame/lib/libmp3lame.a(set_get.o)(.ARM.exidx.text.lame_set_num_samples+0x0) :
    error : undefined reference to ’__aeabi_unwind_cpp_pr0’
    libmp3lame/lib/libmp3lame.a(set_get.o)(.ARM.exidx.text.lame_set_ogg+0x0) :
    error : undefined reference to ’__aeabi_unwind_cpp_pr0’
    libmp3lame/lib/libmp3lame.a(set_get.o)(.ARM.exidx.text.lame_get_ogg+0x0) :
    error : undefined reference to ’__aeabi_unwind_cpp_pr0’
    libmp3lame/lib/libmp3lame.a(set_get.o)(.ARM.exidx.text.lame_set_quality+0x0) :
    error : undefined reference to ’__aeabi_unwind_cpp_pr0’
    D :/work_dir/battefield3/chimpoon/proj.android/app/jni/../../../../lame/lame-3.100/./libmp3lame/set_get.c:2161 :
    error : undefined reference to ’__aeabi_uidiv’
    D :/work_dir/battefield3/chimpoon/proj.android/app/jni/../../../../lame/lame-3.100/./libmp3lame/set_get.c:2165 :
    error : undefined reference to ’__aeabi_uidivmod’
    D :/work_dir/battefield3/chimpoon/proj.android/app/jni/../../../../lame/lame-3.100/./libmp3lame/set_get.c:2170 :
    error : undefined reference to ’__aeabi_uidiv’

    Please help me to resolve this issue. Thanks.

  • Why doesn't seem to be able to send an audio file with FRONT_COVER on the Pytelegrambotapi

    27 décembre 2024, par exorik

    In general the problem is that the audio file is sent to a file without a picture. I first thought that the problem is that the picture is installed on the wrong version of id3, and tried four methods of installation

    


      

    1. via the ffmpeg command = [ “ffmpeg”, “-i”, file_path, “-i”, cover_path, “-map”, “0”, “-map”, “1”, “-c:a”, “copy”, “-c:v”, “mjpeg”, “-id3v2_version”, “3“,”-y”, output_file, ]subprocess.run(command, check=True)

      


    2. 


    3. via eyed3, audiofile.tag.images.set(
eyed3.id3.frames.ImageFrame.FRONT_COVER,
cover_data,
“` image/jpeg,
)

      


    4. 


    5. through the mutagen library, tried setting audio.add(
APIC(
encoding=3,
mime=“image/jpeg”,
type=3,
desc=“Cover”,
data=open(saved_photo, “rb”).read(),
)
)
At this stage I realized that the problem is not in the correct id3 tag setting, but in the method through which the audio file is sent. because if I opened it manually and sent it, the cover was there.
But I also tried installing the tag. second version. through the eyed3 library, but that also didn't result in the audio file with the cover art being sent to telegram.

      


    6. 


    


    audiofile w/ out cover

    


    and the exact same audio file, only with the cover art. (it hasn't been altered in any way)

    


    


user_states = {}




def save_audio(message):
    file_info = bot.get_file(message.audio.file_id)
    downloaded_file = bot.download_file(file_info.file_path)

    user_dir = os.path.join("TEMP", str(message.chat.id), "albums")
    os.makedirs(user_dir, exist_ok=True)

    original_file_name = (
        message.audio.file_name
        if message.audio.file_name
        else f"{message.audio.file_id}.mp3"
    )

    file_path = os.path.join(user_dir, original_file_name)

    if message.chat.id not in user_states:
        user_states[message.chat.id] = {"files": [], "stage": None}

    with open(file_path, "wb") as f:
        f.write(downloaded_file)

    user_states[message.chat.id]["files"].append(file_path)

    return file_path


def clear_metadata_for_file(file_path, user_id):
    clear_metadata = settings.get(str(user_id), {}).get("clear", True)

    if clear_metadata:
        temp_file_path = f"{file_path}.temp.mp3"
        command = [
            "ffmpeg",
            "-i",
            file_path,
            "-map_metadata",
            "-1",
            "-c:a",
            "copy",
            "-y",
            temp_file_path,
        ]
        subprocess.run(command, check=True)
        os.replace(temp_file_path, file_path)

        audio_file = eyed3.load(file_path)
        if audio_file.tag is not None:
            audio_file.tag.clear()
        audio_file.tag.save()

    else:
        return file_path


def send_files(message):
    chat_id = message.chat.id
    if chat_id not in user_states or "files" not in user_states[chat_id]:
        return "No files found"

    for file_path in user_states[chat_id]["files"]:
        try:
            with open(file_path, "rb") as f:
                bot.send_audio(chat_id, f)
        except Exception as e:
            return e



@bot.message_handler(content_types=["photo"])
def handle_cover(message):

    if message.content_type == "photo":
        try:

            saved_photo = save_photo(message)


            for file_path in user_states[message.chat.id]["files"]:

                audio = ID3(file_path)
                audio.add(
                    APIC(
                        encoding=3,
                        mime="image/jpeg",
                        type=3,
                        desc="Cover",
                        data=open(saved_photo, "rb").read(),
                    )
                )
                audio.save(file_path)
                with open(saved_photo, "rb") as image_file:
                    image_data = image_file.read()

                audiofile = eyed3.load(file_path)

                if audiofile.tag is None:
                    audiofile.initTag(version=(2, 3, 0))

                audiofile.tag.images.set(
                    3, image_data, "image/jpeg", description="Cover"
                )
                audiofile.tag.save(version=(2, 3, 0))

            send_files(message)

        except Exception as e:
            return

bot.infinity_polling()



    


    I was hoping to get some audio files with cover art, and I'm sure there's no problem with that. But for some reason, the file itself is sent visually without the cover art. I'd really appreciate it if you could help me out with this.

    


  • FFMPEG-Convert video from variable FPS to fixed FPS, without reencode

    23 janvier 2021, par the_RR

    Context

    


    Some videos are composed by joining several other videos with the same codec / resolution.
The ffmpeg 'concat' function is commonly used to accomplish this task.

    


    When concatenating videos of the same codec, resolution, but with different FPS, there will be no error, being concatenated without reencoding and generating a video file with variable FPS.

    


    With metadata similar to :

    


    Frame rate                     : 29.838 FPS
Minimum frame rate             : 2.602 FPS
Maximum frame rate             : 29.970 FPS
Original frame rate            : 12.500 FPS


    


    note_01 : Metadata extracted from wmpc. See the full metadata information

    


    The problem with this profile is that some streaming platforms, despite recognizing the x264 codec and format profile High, do not play streaming videos with variable FPS.
    
Example : Sending video using python lib pyrogram via API to Telegram.

    


    Attempts to solve

    


    All failures, because it was not possible to find a method without reencode that does not generate loss of sync with audio.

    


    With reencode

    


    Result : The transformation process is very long (6x), as there is a reencode. But the FPS becomes successfully fixed. As it takes time, it does not meet the purpose of the search.

    


    ffmpeg -i "input.mp4" -filter:v fps=fps=12.5 "output.mp4"

    


    Without reencode

    


    Result : The complete process is fast (50x), but it generates a side effect of increasing the length of the video, losing the synchronization of the video with the audio. 01h 45min 24sec video, it was improperly transformed into 04h 11min 36sec.

    


    note_02 : This side effect of loss of sync, only occurs when the the input_video has variable FPS. But performs perfectly when the video already has fixed FPS, serving as a means for changing FPS, with 'setpts' flag that accelerates/decelerate the video to counterbalance the effect of the FPS change without reencode in duration, as describe here.

    
Steps


    ffmpeg -y -i "input.mp4" -c copy -f h264 "output_raw_bitstream.h264"
ffmpeg -i "input.mp4" -vn -acodec copy "input_audio.aac"
ffmpeg -r 12.5 -i "input_audio.aac" -i "output_raw_bitstream.h264" -acodec copy -vcodec copy "output.mp4"


    


      

    • 01-Generate raw_bitstream version
    • 


    • 02-Extract audio
    • 


    • 03-Merge raw_bitstream and audio, defining the new FPS
    • 


    


    note_03 : Process suggested in the topic Using ffmpeg to change framerate

    


    note_04 : I also tried to pass '-bsf : v h264_mp4toannexb' in the previous process, generating a .ts file, before turning the video into raw_bitstream.
    
Unfortunately it generated the same result.

    


    The search continues...