Opened 8 weeks ago

Closed 7 weeks ago

#11197 closed defect (invalid)

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 8 weeks ago.
ffmpeg debug log on ubuntu
mac-ffmpeg-20240918-190756.log (218.6 KB ) - added by Mahendran 8 weeks ago.
ffmpeg debug log on macOS

Download all attachments as: .zip

Change History (5)

by Mahendran, 8 weeks ago

ffmpeg debug log on ubuntu

by Mahendran, 8 weeks ago

ffmpeg debug log on macOS

comment:1 by Cigaes, 8 weeks ago

Hi.

Do not use ffmpeg 4.2 nowadays.

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

comment:2 by Mahendran, 7 weeks ago

I upgraded to ffmpeg 7.x from tar.xz file inside my ubuntu docker. Its working good. Please close this ticket. Thanks very much for the support.

comment:3 by ePirat, 7 weeks ago

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.