0

I need to concatenate two clips which had the following encoding

Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 320x240 [SAR 4:3 DAR 16:9], 100 kb/s, 23.98 fps, 23.98 tbr, 19184 tbn, 47.96 tbc (default)

Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 261 kb/s, 23.98 fps, 23.98 tbr, 48k tbn, 47.95 tbc (default)

using the normal concat method spoils the second clip video stream

ffmpeg -y -f concat -safe 0 -i filesname.txt -vcodec copy -acodec copy 1.mp4

What is the required encoding I need to apply to the first clip to make it easily join-able with the the first?

Note: The first clip was of the following specs and I encoded it using the following command to match the specs of the second clip.

Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 320x240 [SAR 4:3 DAR 16:9], 61 kb/s, 23.98 fps, 23.98 tbr, 19184 tbn, 47.96 tbc (default)

ffmpeg -i 1_original.mp4 -c:v libx264 -preset slow -profile:v baseline -vf scale=320x240 -r 23.98 -c:a aac -ar 44100 1.mp4
A_Matar
  • 1,720
  • 3
  • 23
  • 45

1 Answers1

1

Problem

Your timebase varies between inputs, but the timebase must be the same to concatenate. The second input has a frame rate of 24000/1001. (Unfortunately the console output shows a rounded value, but you can refer to ffprobe -v error -show_streams input.mp4). However, you re-encoded the other video to a frame rate of 23.98. This resulted in a timescale difference of 19184 tbn vs 48k tbn.

Solution

Use -r 24000/1001 (or the alias -r ntsc-film):

ffmpeg -i 1_original.mp4 -c:v libx264 -preset slow -profile:v baseline -vf setsar=1 -r 24000/1001 -c:a aac -ar 44100 1.mp4
  • I replaced the scale filter with setsar to fix the aspect ratio difference, although the difference won't stop the concat demuxer.

  • If your frame rates are actually the same, but the timescale differs, then you can remux instead with -c copy and -video_track_timescale. There are several examples of using this option on this site.

llogan
  • 87,794
  • 21
  • 166
  • 190