Convert .ts file to .mp4

Hi,

I am trying to convert .ts file with audio to a .mp4 with the same audio. I tried below mentioned command and is successful in converting the video.

gst-launch-1.0 filesrc location=convert1.ts ! tsdemux ! "video/x-h264,profile=high" ! h264parse ! mp4mux ! filesink location=chk.mp4

The video file is made without errors.

How can I add the audio to the above pipeline which is in the .ts file to the .mp4 file. The audio info of the .ts file

Audio
ID : 66 (0x42)
Menu ID : 1 (0x1)
Format : AAC LC
Format/Info : Advanced Audio Codec Low Complexity
Format version : Version 4
Muxing mode : ADTS
Codec ID : 15-2
Duration : 2 min 10 s
Bit rate mode : Variable
Channel(s) : 1 channel
Channel layout : C
Sampling rate : 44.1 kHz
Frame rate : 43.066 FPS (1024 SPF)
Compression mode : Lossy
Delay relative to video : -416 ms
Language : English

Thank You

Hi,
It is easier to use ffmpeg. Please install ffmpeg and try

$ ffmpeg -i convert1.ts -c copy chk.mp4

Hi DaneLLL,

Thank you for the reply

In my application I need to run encoding of 2 1080p streams with audio from v4l2rc sources while the file is being converted. ffmpeg uses much cpu so that the encoding process with looses frames in the encoded output. When I tried with above gstreamer pipeline that did not occur.

Since the video wrapping from ts to mp4 work using the above pipeline gstreamer Is there a method to mux the audio from the file using gstreamer?

And, Is it possible to run the ffmpeg commans utilizing the GPU of jetson nano?

Thank you

Hi,
It doesn’t decode and then encode h264 stream in the command, so you should see same CPU usage in both gstreamer and ffmpeg.

Thank you I will try this method

I saw a document where NVIDIA has developed a method to use GPU for ffmpeg is this applicable for jetson nano?

https://developer.nvidia.com/designworks/dl/Using_FFmpeg_with_NVIDIA_GPU_Hardware_Acceleration-pdf

Hi,
For using gstreamer pipeline, please try

$ gst-launch-1.0 qtmux name=mx ! filesink location=test.mp4 filesrc location= test.ts ! tsdemux name=dmx dmx. ! queue ! h264parse ! mx. dmx. !  queue ! aacparse ! faad ! audioresample ! audioconvert ! voaacenc ! mx.

Somehow audio stream has to be decompressed and compressed again. This may take more CPU usage than ffmpeg.

For ffmpeg with hardware acceleration, please check
Jetson Nano FAQ
Q: Is hardware acceleration enabled in ffmpeg?

Thank You I will try this pipeline