0

this is my first post (on video.stackexchange.com).

I need some explanation regarding to re-encoding a single .ts chunk and then use cat command.

I'll explain my scenario.

I've a lot of .ts chunks that all together create a smooth video. Tested.

To create a single video I use the classic linux cat command, and everything works a treat.

BUT

These "lot of .ts chunks" reside on a web-hosting where, obviously, it is not possible to install ffmpeg, but I can use cat command (through PHP's shell_exec).


My goal is to apply an audio/video fade-in on first chunk (and so far I've done it with -vf "fade=t=in:st=0.1:d=1" and -af "afade=t=in:st=0.1:d=1") on my local machine and then, after uploaded the "faded chunk" on remote web-hosting, cat the faded chunk + remaing chunks.


My actual results

My concatenated-chunks-video has a frame-gap at the end of the "faded chunk" and the beginning of the next chunk. After this, plays smoothly.


CLI

ffmpeg -i /path/to/first_chunk.ts -vf "fade=t=in:st=0.1:d=1, format=yuv420p" -af "afade=t=in:st=0.1:d=1" -c:v libx264 -b:v 5099.998K -profile:v main -level:v 4.0 -c:a aac -b:a 279000 -strict experimental -y /path/to/first_chunk_fade_in.ts

cat /path/to/first_chunk_fade_in.ts /path/to/2nd_chunk.ts /path/to/3rd_chunk.ts /path/to/4th_chunk.ts /path/to/5th_chunk.ts > /path/to/merged.ts

Note:

All -c:v, -b:v, -profile:v, -level:v, -c:a, -b:a values were recovered and / or calculated from the original chunk using ffprobe


Any ideas? Or do I have to re-encode the whole file?

Many thanks

8
  • Add -copyts and check.
    – Gyan
    Apr 10 '19 at 18:52
  • I try immediately.... Apr 10 '19 at 18:56
  • With -copyts I lose the fade Apr 10 '19 at 19:10
  • Instead of st, use the start frame and sample options instead.
    – Gyan
    Apr 10 '19 at 19:48
  • same thing. Ok for fade but gap remains. I believe, however, that problem is not attributable to the video stream, but rather to the audio track. I explain to you. I open the merged file with VLC. Starting from the beginning of the stream, if I PLAY, there's the gap, but if I make a frame-by-frame (shortcut "e" on VLC), no gap occurs and everything runs smoothly. Since VLC does not handle audio on the frame-by-frame (the video becomes mute), I think it's the audio track "in some way" carries with it the video track trying to "put it in sync", creating this little hop in the junction point. Apr 10 '19 at 21:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.