Recherche avancée

Médias (1)

Mot : - Tags -/MediaSPIP

Autres articles (108)

Sur d’autres sites (15686)

  • As part of my program that I am writing I am using ffmpeg. I am debugging. Why would ffmpeg run slower on a GPU than a CPU when doing mp4 compression ? [closed]

    6 mai 2023, par user875234

    I'm running it on modern equipment with latest drivers. I use it to compress video files, like so :

    


    ffmpeg -i 20230502_200913.mp4 -vcodec libx265 -crf 28 -vf "scale=trunc(iw/10)*2:trunc(ih/10)*2" output.mp4


    


    that command runs in 160 seconds on the CPU. but if I use the GPU, like so :

    


    ffmpeg -hwaccel cuda -i 20230502_200913.mp4 -vcodec libx265 -crf 28 -vf "scale=trunc(iw/10)*2:trunc(ih/10)*2" output.mp4


    


    it actually takes 280 seconds. And again, these are same era CPU and GPU. I can see it uses 100% of the GPU when running on the GPU but only 50% of the CPU when running on the CPU. I expected it to run much faster on the GPU than the CPU.

    


    Am I missing something ?

    


  • Player downloads all moof part of a fragment mp4 file before playing

    28 mars 2023, par happyz90

    I converted a mp4 to fragment mp4 with the following command :

    


    ffmpeg -i ./input.mp4 -y -b:a 32k -vcodec libx265 -b:v 320k -bufsize 320k -tag:v hvc1 -color_primaries bt709 -color_trc bt709 -colorspace bt709 -c:a libfdk_aac -profile:a aac_he_v2 -movflags faststart+frag_keyframe+empty_moov+dash+global_sidx -chunk_duration 500000000 -max_muxing_queue_size 1024 ./output.mp4


    


    But when playing, the player send many http requests to download all the moof part :

    


    enter image description here

    


    enter image description here

    


    But I think in normal case the player only need to download the head part of the video file to play.

    


    So is there anything wrong with my ffmpeg parameters ? Please help me. Thank you.

    


  • pydub returning zero byte file when I try to export part of an Mp3

    25 janvier 2023, par tom f

    I'm sharing this for posterity, since I already figured out the answer. I'm trying to create preview snippets of MP3 files with pydub in Python, but when I ran the export the files were always zero bytes in size.

    



    example :

    



    from pydub import AudioSegment    

sound = AudioSegment.from_mp3("preview_temp/n/1/mp3/01_Beyond_and_Into_the_Ultimate.mp3")

# len() and slicing are in milliseconds
halfway_point = len(sound) / 2

second_half = sound[halfway_point:]
print second_half
second_half.export("preview_temp/n/1/prev/prev_test.mp3", format="mp3", bitrate="192k")


    



    I verified the source file existed and was accessible. My inkling was this had something to do with ffmpeg. It was installed properly, but then I came across this on the pydub github :

    



    


    You may use libav or ffmpeg. libav is recommended.

    


    



    The pydub developer runs through installation on several platforms on the github wiki. I'm sharing it here to make it easier for folks to find, though.