Recherche avancée

Médias (0)

Mot : - Tags -/images

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (69)

  • 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 (...)

  • MediaSPIP Core : La Configuration

    9 novembre 2010, par

    MediaSPIP Core fournit par défaut trois pages différentes de configuration (ces pages utilisent le plugin de configuration CFG pour fonctionner) : une page spécifique à la configuration générale du squelettes ; une page spécifique à la configuration de la page d’accueil du site ; une page spécifique à la configuration des secteurs ;
    Il fournit également une page supplémentaire qui n’apparait que lorsque certains plugins sont activés permettant de contrôler l’affichage et les fonctionnalités spécifiques (...)

  • Gestion des droits de création et d’édition des objets

    8 février 2011, par

    Par défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;

Sur d’autres sites (5720)

  • How to write to fifo in while loop and read in continuous process

    18 avril 2019, par Russ_ell

    I’m running 3 multiprocess while loops that each write to seperate fifo’s , that are read by a continuously running ffmpeg process. This runs for the first loop of each process then stops.

    The code below is one of the write loops ( the other two are pretty much the same ), and the read process.

    def dubv():
       while True:
         print('loop')
         file, dur = getFile('vocal')
         fx = (
             AudioEffectsChain()
             .delay()
         )
         songvfx = fx(file)
         with open('/tmp/pipe2.fifo', 'wb') as p1:
             print('open s fifo')
             p1.write(songvfx.T.tobytes())
             p1.close()
             print('close s fifo')
         del songvfx

    def mixer():
       command4 = [
           'ffmpeg',
           '-nostdin',
           '-re',
           '-y',
           '-thread_queue_size', '4096',
           '-ac', '2',
           '-ar', '44100',
           '-f', 'f32le',
           '-i', '/tmp/pipe1.fifo',
           '-thread_queue_size', '4096',
           '-ac', '2',
           '-ar', '44100',
           '-f', 'f32le',
           '-i', '/tmp/pipe2.fifo',
           '-thread_queue_size', '4096',
           '-ac', '2',
           '-ar', '44100',
           '-f', 'f32le',
           '-i', '/tmp/pipe3.fifo',
           '-filter_complex', '[0][1][2]amix=inputs=3:dropout_transition=3[map]',
           '-map', '[map]',
           '-c:a', 'libmp3lame',
           '-b:a', '320k',
           '-f', 'mp3',
           'icecast://source:hackme@localhost:8000/test'
       ]
       o = open('/tmp/pipe1.fifo', 'rb')
       o2 = open('/tmp/pipe2.fifo', 'rb')
       o3 = open('/tmp/pipe3.fifo', 'rb')
       mix = sp.Popen(command4, stdin=DEVNULL, bufsize=4096)
       mix.wait()

    I’d like the write process to write to fifo2 , then loop and continue writing to fifo2 , to be read in the mixer process continuously.

    EDIT :

    I think the problem is coming from the reader closing as the loop runs once , then runs round the loop , open the fifo but never prints ’close s fifo’ again , so i presume it cant write to the file ?

    EDIT 2 :

    I have resolved this by moving the fifo close out of the loop. My writer is now

    def dubv():
     with open('/tmp/pipe2.fifo', 'wb') as p2:
       while True:
         print('loop')
         file, dur = getFile('vocal')
         fx = (
             AudioEffectsChain()
             .delay()
         )
         songvfx = fx(file)
         p2.write(songvfx.T.tobytes())
         del songvfx
         time.sleep(2)
     p2.close()
     print('close s fifo')

    and the reader doesn’t open the fifo files as ffmpeg seems to deal with this.

    def mixer():
     command4 = [
         'ffmpeg',
         '-re',
         '-y',
         '-thread_queue_size', '4096',
         '-ac', '2',
         '-ar', '44100',
         '-f', 'f32le',
         '-i', '/tmp/pipe1.fifo',
         '-thread_queue_size', '4096',
         '-ac', '2',
         '-ar', '44100',
         '-f', 'f32le',
         '-i', '/tmp/pipe2.fifo',
         '-thread_queue_size', '4096',
         '-ac', '2',
         '-ar', '44100',
         '-f', 'f32le',
         '-i', '/tmp/pipe3.fifo',
         '-filter_complex', '[0][1][2]amix=inputs=3:dropout_transition=3[map]',
         '-map', '[map]',
         '-c:a', 'libmp3lame',
         '-b:a', '320k',
         '-f', 'mp3',
         'icecast://source:hackme@localhost:8000/test'
     ]
     mix = sp.Popen(command4, stdin=DEVNULL, bufsize=4096)
     mix.wait()

    If anybody see a ’better’ solution please comment.

    Thank you

  • Accented characters are not recognized in python [closed]

    10 avril 2023, par CorAnna

    I have a problem in the python script, my script should put subtitles in a video given a srt file, this srt file is written by another script but in its script it replaces the accents and all the particular characters with a black square symbol with a question mark inside it... the problem I think lies in the writing of this file, what follows and that in overwriting the subtitles I do with ffmpeg the sentences that contain an accented word are not written

    


    def video_audio_file_writer(video_file):

    videos_folder = "Video"
    audios_folder = "Audio"

    video_path = f"{videos_folder}\\{video_file}"

    video_name = Path(video_path).stem
    audio_name = f"{video_name}Audio"

    audio_path = f"{audios_folder}\\{audio_name}.wav"

    video = mp.VideoFileClip(video_path)
    audio = video.audio.write_audiofile(audio_path)

    return video_path, audio_path, video_name

    def audio_file_transcription(audio_path, lang):

    model = whisper.load_model("base")
    tran = gt.Translator()

    audio_file = str(audio_path)

    options = dict(beam_size=5, best_of=5)
    translate = dict(task="translate", **options)
    result = model.transcribe(audio_file, **translate)   

    return result

def audio_subtitles_transcription(result, video_name):

    subtitle_folder = "Content"
    subtitle_name = f"{video_name}Subtitle"
    subtitle_path_form = "srt"

    subtitle_path = f"{subtitle_folder}\\{subtitle_name}.{subtitle_path_form}"

    with open(os.path.join(subtitle_path), "w") as srt:
        # write_vtt(result["segments"], file=vtt)
        write_srt(result["segments"], file=srt)
            
    return subtitle_path

def video_subtitles(video_path, subtitle_path, video_name):

    video_subtitled_folder = "VideoSubtitles"
    video_subtitled_name = f"{video_name}Subtitles"
    video_subtitled_path = f"{video_subtitled_folder}\\{video_subtitled_name}.mp4"

    video_path_b = bytes(video_path, 'utf-8')
    subtitle_path_b = bytes(subtitle_path, 'utf-8')
    video_subtitled_path_b = bytes(video_subtitled_path, 'utf-8')

    path_abs_b = os.getcwdb() + b"\\"

    path_abs_bd = path_abs_b.decode('utf-8')
    video_path_bd= video_path_b.decode('utf-8')
    subtitle_path_bd = subtitle_path_b.decode('utf-8')
    video_subtitled_path_bd = video_subtitled_path_b.decode('utf-8')

    video_path_abs = str(path_abs_bd + video_path_bd)
    subtitle_path_abs = str(path_abs_bd + subtitle_path_bd).replace("\\", "\\\\").replace(":", "\\:")
    video_subtitled_path_abs = str(path_abs_bd + video_subtitled_path_bd)

    time.sleep(3)

    os.system(f"ffmpeg -i {video_path_abs} -vf subtitles='{subtitle_path_abs}' -y {video_subtitled_path_abs}")

    return video_subtitled_path_abs, video_path_abs, subtitle_path_abs

if __name__ == "__main__":

    video_path, audio_path, video_name = video_audio_file_writer(video_file="ChiIng.mp4")
    result = audio_file_transcription(audio_path=audio_path, lang="it")
    subtitle_path = audio_subtitles_transcription(result=result, video_name=video_name)
    video_subtitled_path_abs, video_path_abs, subtitle_path_abs = video_subtitles(video_path=video_path, subtitle_path=subtitle_path, video_name=video_name)
    
    print("Video Subtitled")


    


    Windows 11
Python 3.10

    


  • FFmpeg starting manually but not with Systemd on boot

    23 juin 2021, par eKrajnak

    On Raspberry Pi 4 B 4GB with official Debian 10 image, I have /home/pi/run.sh script with following :

    


    #!/bin/bash
ffmpeg -nostdin -framerate 15 -video_size 1280x720 -input_format yuyv422  -i /dev/video0 -f alsa -i hw:Device \
    -af acompressor=threshold=-14dB:ratio=9:attack=10:release=1000 -c:a aac -ac 2 -ar 48000 -ab 160k \
    -c:v libx264 -pix_fmt yuv420p -b:v 3M -bf 1 -g 20 -flags +ilme+ildct -preset ultrafast \
    -streamid 0:0x101 -streamid 1:0x100 -mpegts_pmt_start_pid 4096 -mpegts_start_pid 0x259 -metadata:s:a:0 language="" -mpegts_service_id 131 -mpegts_transport_stream_id 9217 -metadata provider_name="Doesnt matter" -metadata service_name="Doesnt matter" \
    -minrate 3500 -maxrate 3500k -bufsize 4500k -muxrate 4000k  -f mpegts "udp://@239.1.67.13:1234?pkt_size=1316&bitrate=4000000&dscp=34" -loglevel debug < /dev/null > /tmp/ff3.log 2>&1


    


    Script is starting from console without problems. It takes audio from USB sound card and video from USB camera and creates UDP stream to IPTV. Then I created Systemd service :

    


    [Unit]
Description=Streamer
After=multi-user.target sound.target network.target

[Service]
ExecStart=/home/pi/run.sh
KillMode=control-group
Restart=on-failure
TimeoutSec=1

[Install]
WantedBy=multi-user.target
Alias=streaming.service


    


    After restarting Raspberry, script has started, but FFmpeg hangs on error failures in log :

    


    cur_dts is invalid st:0 (257) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
cur_dts is invalid st:1 (256) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
cur_dts is invalid st:0 (257) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
cur_dts is invalid st:1 (256) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
cur_dts is invalid st:0 (257) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
cur_dts is invalid st:1 (256) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
cur_dts is invalid st:0 (257) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
cur_dts is invalid st:1 (256) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)


    


    and will not start streaming to UDP target. But, if I manually login to SSH and issue systemctl stop streaming and then systemctl start streaming Ffmpeg starts successfully. What's different with service auto-start on boot ?

    


    Setting the "sleep timeout" at script begginging will not help. However, removing audio stream from FFmpeg config looks to solve auto-start on boot.