[FFmpeg-trac] #11197(ffmpeg:new): Video duration mismatch between macOS and Ubuntu when transcoding with libx264

FFmpeg trac at avcodec.org
Wed Sep 18 17:17:17 EEST 2024


#11197: Video duration mismatch between macOS and Ubuntu when transcoding with
libx264
-----------------------------------+---------------------------------------
             Reporter:  Mahendran  |                     Type:  defect
               Status:  new        |                 Priority:  important
            Component:  ffmpeg     |                  Version:  unspecified
             Keywords:  ffmpeg     |               Blocked By:
             Blocking:             |  Reproduced by developer:  0
Analyzed by developer:  0          |
-----------------------------------+---------------------------------------
 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

 2. 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.

 3. 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

 4. 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

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

 6. 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?

 7. Files attached:
 Ubuntu and macOS log files
 Input video: samplevideo.mp4
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/11197>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list