Opened 25 hours ago

Last modified 25 hours ago

#11197 new defect

Video duration mismatch between macOS and Ubuntu when transcoding with libx264

Reported by: Mahendran Owned by:
Priority: important Component: ffmpeg
Version: unspecified Keywords: ffmpeg
Cc: Mahendran Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

  1. What you were trying to accomplish:

I am trying to transcode a video from mp4 format to mp4 with H.264 encoding (libx264) using the same FFmpeg command on both macOS and Ubuntu. I aim to keep the input video's original duration and apply some video filters such as frame rate control (fps=30) and resizing (scale=480:640).
Command:
Copy code
ffmpeg -i samplevideo.mp4 -vf "fps=30,scale=480:640" -c:v libx264 -profile:v baseline -pix_fmt yuvj420p -r 30 -b:v 4294k -an samplevideo_converted.mp4

  1. The problem you encountered:

On macOS: The converted video has the same duration (6 seconds) as the input video, which is the expected behavior.
On Ubuntu: The converted video has a duration of only 1 second, even though the input video is 6 seconds.
I am expecting both platforms to produce videos with consistent durations.

  1. The exact command lines you were using:

macOS Command:
ffmpeg -report -v 9 -loglevel 99 -i samplevideo.mp4 -vf "fps=30,scale=480:640" -c:v libx264 -profile:v baseline -pix_fmt yuvj420p -r 30 -b:v 4294k -an mac-samplevideo_converted.mp4

Ubuntu Command:
ffmpeg -v 9 -loglevel 99 -i /tmp/samplevideo.mp4 -vf "fps=30,scale=480:640" -c:v libx264 -profile:v baseline -pix_fmt yuvj420p -r 30 -b:v 4294k -an /tmp/ubuntu-samplevideo_converted.mp4

  1. Full console output:

The full, uncut console output from both platforms (macOS and Ubuntu) is attached as:
ubuntu-ffmpeg-20240918-190119.log
mac-ffmpeg-20240918-185939.log

  1. Input file:

Input file: samplevideo.mp4 (duration: 6 seconds)

  1. Additional Notes:

Is the use of yuvj420p causing issues on one platform but not the other? Should I switch to yuv420p?
Could the redundancy between -r 30 and fps=30 in the -vf filter be contributing to the discrepancy in video durations?
Is there any other platform-specific behavior I should be aware of that might cause this inconsistency?

  1. Files attached:

Ubuntu and macOS log files
Input video: samplevideo.mp4

Attachments (2)

ubuntu-ffmpeg-20240918-190947.log (61.5 KB ) - added by Mahendran 25 hours ago.
ffmpeg debug log on ubuntu
mac-ffmpeg-20240918-190756.log (218.6 KB ) - added by Mahendran 25 hours ago.
ffmpeg debug log on macOS

Download all attachments as: .zip

Change History (3)

by Mahendran, 25 hours ago

ffmpeg debug log on ubuntu

by Mahendran, 25 hours ago

ffmpeg debug log on macOS

comment:1 by Cigaes, 25 hours ago

Hi.

Do not use ffmpeg 4.2 nowadays.

Test with the same version of FFmpeg and you will probably get the same results.

Note: See TracTickets for help on using tickets.