Newest 'libx264' Questions - Stack Overflow

http://stackoverflow.com/questions/tagged/libx264

Les articles publiés sur le site

  • x264/x265 options for fast decoding while preserving quality

    18 août 2024, par user3301993

    I want to encode some videos in H264 and H265, and I would like to ask for help in order to chose the adequate options in x264/x265.

    • My first priority is video quality. Lossless would be the best quality for example
    • My second priority is fast decoding speed (ie: I would like faster decoding without sacrificing quality)
      • fast decoding for me means that the decoding machine would use less CPU resources reading the resulting video
      • Less RAM consumption would be a plus
      • Latency is not important
    • I don't care that much if the output file ends up bigger. Also, encoding speed is not important

    I'm aware of the option -tune fastdecode in both x264 and x265. But apparently the quality gets a bit worse using it.

    For x264:

    -tune fastdecode is equivalent to --no-cabac --no-deblock --no-weightb --weightp 0 (My source is x264 --fullhelp)

    Which options preserve quality ?

    For x265:

    -tune fastdecode is equivalent to --no-deblock --no-sao --no-weightp --no-weightb --no-b-intra (according to x265 doc)

    Again, which options preserve quality ?

    I tried to read some documentation on these options, but I'm afraid I'm too stupid to understand if they preserve quality or not.

    To explain further what I mean by "preserving quality":

    I don't understand what the cabac option does exactly. But let's say for example that it adds some extra lossless compression, resulting in a smaller video file, but the decoding machine would need to do extra work to decompress the file

    In that case, the --no-cabac option would skip that extra compression, resulting in no loss of quality, with a bigger file size, and the decoding machine would not need to decompress the extra compression, saving CPU work on the decoding side

    In this scenario, I would like to add the --no-cabac option, as it speeds up decoding, while preserving quality.

    I hope I could get my point across

    Can anyone help me pick the right options ?

    Thanks in advance

  • Previewing mp4 video of cv2s VideoWriter not possible

    19 juin 2024, par user22614632

    I am writing a machine learning football analysis system, and I want to store the result video as seen in the code block. I can see the video normally under Windows' media player, but in VSCode and Streamlit, I can't open/show the video.

    Edit: On Mac, it works perfectly well.

    def save_video(frames: List[np.ndarray], path: str, fps: int=24) -> None:
        fourcc = cv2.VideoWriter_fourcc(*"avc1")    # codec for compressing the video
        out = cv2.VideoWriter(filename=path, fourcc=fourcc, fps=fps, frameSize=(frames[0].shape[1], frames[0].shape[0]))
        
        for frame in frames:
            out.write(frame)
        
        # close video file and release ressources
        out.release() 
    

    I thought it might be a slightly different mp4? I also used mp4v for fourcc, didn't help.

  • How to check 'Output bit depth' of the libx264 library in ffmpeg ?

    26 mai 2024, par Greg

    According to the x264 Encoding Guide, the crf scale depends on whether x264 is 8-bit or 10-bit. Supposedly x264 --help shows the Output bit depth. But on Windows ffmpeg -h full doesn't say anything about Output bit depth and the crf scale option is described as from -1 to FLT_MAX. How can I check if my ffmpeg is using 8-bit or 10-bit version of the libx264 library?

  • How to transcode short video using FFmpeg, libx264 codec, Swift, iOS app

    21 mars 2024, par Dmitriy iOS

    The goal is to transcode a short video into .mov format using FFmpeg and libx264 codec. So far I have not been able to do this using third-party libraries. Using the command line, the video is perfectly transcoded, but I need it inside the application.

    If anyone has a solution I would be very grateful.

    The resulting video needs to have the following parameters, something like this:

    Picture 1 Picture 2 Picture 3

    For example:

    let command = ["ffmpeg", "-i", videoOutputURL.path, "-c:v", "libx264", "-c:a", "copy", convertedVideoUrl.path]
    let ffmpegCommand = ffmpeg(command)
    
  • ffmpeg Connection to tcp ://127.0.0.1:1935 refused on Windows 10

    6 mars 2024, par Wissam Elias

    I am trying to re-stream an RTSP connection on the local network using this command:

    ffmpeg -loglevel debug -rtsp_transport tcp -i rtsp://192.168.1.13:1935 -codec copy -f rtsp rtsp://172.0.0.1:1935/live/stream
    

    but i am getting an error message:

    [tcp @ 0000020c99c4c1c0] Connection to tcp://127.0.0.1:1935 failed: Connection refused
    rtsp://127.0.0.1:1935/live/stream: Connection refused
    

    while the port is not used and I've tried to use 8554 also with the same result, and the firewall on my device is turned off.