Transcoding mov to mp4 Gstreamer

i am trying to convert a file mov (apple prores) to mp4 following this command found in the forum is correct?

gst-launch-1.0 filesrc location=filename.mov !
qtdemux name=demux demux.video_0 ! queue ! h264parse ! omxh264dec !
omxh264enc ! ‘video/x-h264, stream-format=(string)byte-stream’ !
h264parse ! qtmux ! filesink location=filename.mp4 -e

You can probably omit at least the decoder and encoder. You don’t need to re-encode if you’re just changing containers. It will just hurt quality and waste system resources. Just demux and remux. Please see the Gstreamer tutorials and the qtmux documentation.

Since you’re not doing any work that needs the GPU, you might also use ffmpeg for this:

https://stackoverflow.com/a/12026739

That’s the same as what you ideally want to do in gstreamer (just copy the video without re-encode). It’s fast and lossless.

Hi,
Please try mdegans’ suggestion. It is not required to re-encoding the h264 stream.

Thanks, I have tried to install ffmpeg but every time install hw acceleration does not go well.
this is the guide:

but every time I follow the instruction on the cmke command …
I get this out and it won’t go on

  • The C compiler identification is GNU 7.4.0
  • The CXX compiler identification is GNU 7.4.0
  • Check for working C compiler: / usr / bin / cc
  • Check for working C compiler: / usr / bin / cc - works
  • Detecting C compiler ABI info
  • Detecting C compiler ABI info - done
  • Detecting C compile features
  • Detecting C compile features - done
  • Check for working CXX compiler: / usr / bin / c ++
  • Check for working CXX compiler: / usr / bin / c ++ - works
  • Detecting CXX compiler ABI info
  • Detecting CXX compiler ABI info - done
  • Detecting CXX compile features
  • Detecting CXX compile features - done
  • Looking for pthread.h
  • Looking for pthread.h - found
  • Looking for pthread_create
  • Looking for pthread_create - not found
  • Looking for pthread_create in pthreads
  • Looking for pthread_create in pthreads - not found
  • Looking for pthread_create in pthread
  • Looking for pthread_create in pthread - found

is there anyone who could help me, maybe by sending me the working image of the jetson nano with ffmpeg?

Thank you and good day

Hi,
You do not need hardware acceleration for mov to mp4 conversion. Actually mov and mp4 are almost the same. Apple Inc defines mov by referring to mp4 spec. You can simply do ‘mv filename.mov filename.mp4’

on jetpack 4.3

replace https://gist.github.com/jocover/7a60c1006e546ed821d4e609d80df765/raw/b5846cd5638832c75d9f7a682ec371c50d5c0192/CMakeLists.txt to jetson-ffmpeg/CMakeLists.txt file

after pasting the contents of the cmakelists.txt file and doing cmake …
it still gives me this error

  • The C compiler identification is GNU 7.4.0
  • The CXX compiler identification is GNU 7.4.0
  • Check for working C compiler: / usr / bin / cc
  • Check for working C compiler: / usr / bin / cc - works
  • Detecting C compiler ABI info
  • Detecting C compiler ABI info - done
  • Detecting C compile features
  • Detecting C compile features - done
  • Check for working CXX compiler: / usr / bin / c ++
  • Check for working CXX compiler: / usr / bin / c ++ - works
  • Detecting CXX compiler ABI info
  • Detecting CXX compiler ABI info - done
  • Detecting CXX compile features
  • Detecting CXX compile features - done
  • Looking for pthread.h
  • Looking for pthread.h - found
  • Performing Test CMAKE_HAVE_LIBC_PTHREAD
  • Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
  • Looking for pthread_create in pthreads
  • Looking for pthread_create in pthreads - not found
  • Looking for pthread_create in pthread
  • Looking for pthread_create in pthread - found
  • Found Threads: TRUE
  • Configuring done
  • Generating done
  • Build files have been written to: / home / vtr / jetson-ffmpeg / build
sudo apt install ffmpeg
ffmpeg -i movie.mov -vcodec copy -acodec copy out.mp4

You do not need a version with hardware acceleration because it’s just copying encoded data. This operation can’t be any further accelerated. It’s already as fast as it can go. As DaneLLL mentions, you can probably also just rename the file to have the .mp4 extension.

thanks i am trying with ffmpeg with this string ffmpeg -i input.mov -q: v 0 output.mp4 and with a prores 422 file it goes to 3fps how can i speed up?

If you actually need to re-encode you will likely need to use gstreamer. You can use qtdemux to demux the video and avdec_prores to decode.

https://gstreamer.freedesktop.org/documentation/libav/avdec_prores.html

After the demuxer and decoder, you need a conversion element and an encoder of choice (some at the same link) a muxer (qtmux), and a filesink.

So something like:

qtdemux ! avdec_prores ! nvvidconv ! nvv4l2h265enc ! qtmux ! filesink

There are probably some caps in there and/or other things I am forgetting. DaneLLL may have a better example. That should allow the process to go a lot quicker.

thanks

Hi,
For h264->h265 trascoding, please try

$ gst-launch-1.0 filesrc location= a.mp4 ! qtdemux ! h264parse ! nvv4l2decoder ! nvv4l2h265enc ! h265parse ! qtmux ! filesink location= b.mp4

i have mov apple proress 422 to mp4.
How can I write the command?

Hi,

YUV422 is not supported by hardware decoder. You may try software decoder such as avdec_h264.