Recherche avancée

Médias (2)

Mot : - Tags -/plugins

Autres articles (41)

  • Keeping control of your media in your hands

    13 avril 2011, par

    The vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
    While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
    MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
    MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...)

  • Use, discuss, criticize

    13 avril 2011, par

    Talk to people directly involved in MediaSPIP’s development, or to people around you who could use MediaSPIP to share, enhance or develop their creative projects.
    The bigger the community, the more MediaSPIP’s potential will be explored and the faster the software will evolve.
    A discussion list is available for all exchanges between users.

  • Installation en mode ferme

    4 février 2011, par

    Le mode ferme permet d’héberger plusieurs sites de type MediaSPIP en n’installant qu’une seule fois son noyau fonctionnel.
    C’est la méthode que nous utilisons sur cette même plateforme.
    L’utilisation en mode ferme nécessite de connaïtre un peu le mécanisme de SPIP contrairement à la version standalone qui ne nécessite pas réellement de connaissances spécifique puisque l’espace privé habituel de SPIP n’est plus utilisé.
    Dans un premier temps, vous devez avoir installé les mêmes fichiers que l’installation (...)

Sur d’autres sites (5850)

  • How to kill command Exec in difference Function in Golang

    26 juillet 2022, par Tammam

    i'm making screen record web based using command exec to run FFMPEG. here I created a startRecording function but I am still confused about stopping the command process in the stopRecording function, because the command is executed in the startRecording function. How to stop a process that is already running in the srartRecording function in the stopRecording function ?

    


    here my code

    


    //Handler to create room/start record
func RoomCreate(c *fiber.Ctx) error {
    fileName := "out.mp4"
    fmt.Println(fileName)
    if len(os.Args) > 1 {
        fileName = os.Args[1]
    }

    

    errCh := make(chan error, 2)
    ctx, cancelFn := context.WithCancel(context.Background())
    // Call to function startRecording
    go func() { errCh <- startRecording(ctx, fileName) }()

    go func() {
        errCh <- nil
    }()
    err := <-errCh
    cancelFn()
    if err != nil && err != context.Canceled {
        log.Fatalf("Execution failed: %v", err)
    }
    
    return c.Redirect(fmt.Sprintf("/room/%s", guuid.New().String()))
}



//Function to run command FFMPEG
func startRecording(ctx context.Context, fileName string) error {
    ctx, cancelFn := context.WithCancel(ctx)
    defer cancelFn()
    // Build ffmpeg
    ffmpeg := exec.Command("ffmpeg",
        "-f", "gdigrab",
        "-framerate", "30",
        "-i", "desktop",
        "-f", "mp4",
        fileName,
    )
    // Stdin for sending data
    stdin, err := ffmpeg.StdinPipe()
    if err != nil {
        return err
    }
    //var buf bytes.Buffer
    defer stdin.Close()
    // Run it in the background
    errCh := make(chan error, 1)

    go func() {
        fmt.Printf("Executing: %v\n", strings.Join(ffmpeg.Args, " "))
        
        if err := ffmpeg.Run(); err != nil {
            return
        }
        //fmt.Printf("FFMPEG output:\n%v\n", string(out))
        errCh <- err
    }()
    // Just start sending a bunch of frames
    for {
        
        // Check if we're done, otherwise go again
        select {
        case <-ctx.Done():
            return ctx.Err()
        case err := <-errCh:
            return err
        default:
        }
    }
}

//Here function to stop Recording
func stopRecording(ctx context.Context) error {
//Code stop recording in here
} 


    


    Thanks for advance

    


  • What's the difference between H265, x265, x264, H264 and which of these uses GPU instead of CPU and how to use H265 GPU NVIDIA acceleration in ffmpeg ?

    30 juillet 2022, par Fab98

    I'm not sure if
x264/5
use CPU and if h264/5 use GPU and also if h265 is basically HEVC_NVENC for NVIDIA GPU acceleration. So, if you could give me more info about these encoding types it would be great. I understood that, summing up a lot, x26* use CPU and are slower but more accurate while h26* are the opposite but h265 is the most recent and optimal trade off.
Furthermore, I was trying to convert a video using GPU acceleration and my question is :

    


    Does the following command tell to the GPU to use h265 to encode a video holding the same audio and at upgrading it at its maximum video quality ? Furthermore, are there other ways to express the same command ?

    


    ffmpeg.exe -hwaccel_output_format cuda -i "input" -c:v hevc_nvenc -preset medium -rc constqp -qp 0 -c:a copy "output"


    


  • Not able to merge init.mp4 and seg-*.m4s with ffmpeg and python due to its file format difference

    1er février 2023, par XiBBaL

    I'm developing video downloader (only for free videos) for korean anime streaming site https://laftel.net/

    


    I guess laftel.net uses mpeg-dash for their streaming.
I found "init.mp4" file and "segments-number.m4s" files in chrome developer tools.

    


    Code below downloads seg-1.m4s (name of the first segment) to seg-239.m4s (name of the last segment) file and init.mp4 file and it works.

    


    
(Skip the beginning becasue there is a code that collects "Request-URL" for each .m4s files in network stream)


#variable "found" is part of the "Request-URL"

def curl_m4s():
    for i in range(1,240): #number of the .m4s segment file is constant at 239
        vid_url = f"https://mediacloud.laftel.net/{found}/video/avc1/2/seg-{i}.m4s"
        aud_url = f"https://mediacloud.laftel.net/{found}/audio/mp4a/eng/seg-{i}.m4s"
        
        if i < 10: #for single digit num
            os.system(f"curl {vid_url} > {location}/vids/vid00{i}.m4s")
            os.system(f"curl {aud_url} > {location}/auds/aud00{i}.m4s")
            sleep(random.randint(1,3))
            
        elif i < 100: #for double digit num
            os.system(f"curl {vid_url} > {location}/vids/vid0{i}.m4s")
            os.system(f"curl {aud_url} > {location}/auds/aud0{i}.m4s")
            sleep(random.randint(1,3))
            
        else: #for three digit num
            os.system(f"curl {vid_url} > {location}/vids/vid{i}.m4s")
            os.system(f"curl {aud_url} > {location}/auds/aud{i}.m4s")
            sleep(random.randint(1,3))

location = os.getcwd()

os.system(f"curl https://mediacloud.laftel.net/{found}/video/avc1/2/init.mp4 > {location}/vids/vid_init.mp4")
os.system(f"curl https://mediacloud.laftel.net/{found}/audio/mp4a/eng/init.mp4 > {location}/auds/aud_init.mp4")
os.system(f"curl https://mediacloud.laftel.net/{found}/stream.mpd > {location}/stream.mpd")

curl_m4s()
#use curl in cmd and downloads each of the .m4s (001 ~ 239)

    


    


    So in the vids folder i have "init.mp4" for video and "seg-1.m4s seg-239.m4s" for video
and in the auds folder i have "init.mp4" for audio and "seg-1.m4s seg-239.m4s" for audio

    


    Problem is, I cannot merge init file and segment files.
I have no idea about combining .mp4 and .m4s together.
There are a lot of example codes for merging init.m4s + seg-.m4s but I couldn't find init.mp4 + seg-.mp4 codes.

    


    I tried to merge segments together first, like this and it works.

    


    location = os.getcwd()

os.system(f"cd {location}")
os.system("copy /b vid*.m4s vid_full.m4s")


    


    and now, i want to merge init.mp4 becasue it has very much information about whole video files.
But how ??

    


    I tried these and none of them worked (looks like Successfull merge but it do not contain any watchable video)

    


    # vid_full is merged segment files (seg-1.m4s + ... + seg-239.m4s)
 
1. 
os.system("copy /b init.mp4 + vid*.m4s video_full.m4s")
os.system("ffmpeg -i video_full.m4s -c:a copy video_full.mp4")


2. 
os.system("type vid_init.mp4 index.txt > Filename.mp4")


3. 
import os 

os.system("ffmpeg -i vid_full.m4s -c:a copy vid_full.mp4")
os.system("copy /b vid_init.mp4 + vid_full.mp4 VIDEO.mp4")


    


    All problem occurs the format of the init file is .mp4. If it was .m4s I guess I could merge it.

    


    and I guess i must merge init file and segments files together both in .m4s format. Is it right ?
Via ffmpeg, i couldn't encode init.mp4 to init.m4s so this is the problme also.

    


    So, Please help me merge init.mp4 and segments.m4s

    


    All methods are wellcome at least it is based on python.

    


      

    1. I tried to merge init.mp4 + merged_segment.m4s but it failed
    2. 


    3. I tried to convert init.mp4 to init.m4s via ffmpeg but it failed
    4. 


    5. I tried to convert all the segments to .mp4 files and merge into init.mp4 but it failed
    6. 


    


    I want to merge init file and segment files and make playable video.
Pleas Teach me how to do this.

    


    Links below are what I used for my test :

    


    [Laftel.net URL]
https://laftel.net/player/40269/46123

    


    [Request URL for init.mp4 (video)]
https://mediacloud.laftel.net/2021/04/46773/v15/video/dash/video/avc1/2/init.mp4

    


    [Request URL for init.mp4 (audio)]
https://mediacloud.laftel.net/2021/04/46773/v15/video/dash/audio/mp4a/eng/init.mp4

    


    [Request URL for seg-1.m4s (video)]
https://mediacloud.laftel.net/2021/04/46773/v15/video/dash/video/avc1/2/seg-1.m4s

    


    [Request URL for seg-1.m4s (audio)]
https://mediacloud.laftel.net/2021/04/46773/v15/video/dash/audio/mp4a/eng/seg-1.m4s