Sending a video file via TCP connection

Hello,

I am sending a video file (.mov file) from a jetson nano to raspberry pi with Ubuntu Server OS.

I’ve written the client and server application to communicate via TCP. I send the file over to Pi in 1024 byte chunks. I have the proper handling in place for packets that are smaller than that size on the sending and receiving ends.

When sending and receiving, I am getting the appropriate amount of bytes that is equivalent to the size of the file, so I am not losing any packets/information.

When I run command below on the jetson nano

ffprobe -i test.mov

I get a correct output from the command:

Input #0, mov, mp4, m4a, 3gp, 3g2, mj2, from 'test.mov'

When I run the same ffprobe() command on the raspberry pi, I get the following errors:

ffprobe version 4.3.2-0+deb11u1ubuntu1 Copyright (c) 2007-2021 the FFmpeg developers
  built with gcc 10 (Ubuntu 10.2.1-20ubuntu1)
  configuration: --prefix=/usr --extra-version=0+deb11u1ubuntu1 --toolchain=hardened --libdir=/usr/lib/aarch64-linux-gnu --incdir=/usr/include/aarch64-linux-gnu --arch=arm64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0xaaaac833b960] Format mov,mp4,m4a,3gp,3g2,mj2 detected only with low score of 1, misdetection possible!
[mov,mp4,m4a,3gp,3g2,mj2 @ 0xaaaac833b960] moov atom not found
test.mov: Invalid data found when processing input

Even though I have received the correct amount of bytes and created a file with the same amount of bytes on the Pi’s side, is there any suggestion as to why the video is unable to be properly decoded/read after file transmission?

Any suggestion will help.

Thank you.

Hi,
If you run this pipeline:
Gstreamer pipeline creation help - #4 by DaneLLL

What you receive in client is only h264 stream. You may modify extension to .h264 and try

$ ffprobe -i test.h264

@DaneLLL
There is some progress. Now when I try to connect using VLC, I can connect to the server but the video doesn’t load.

if I run

ffprobe -i test.h264

I get the following output:

ffprobe -i test.h264
ffprobe version 4.3.2-0+deb11u1ubuntu1 Copyright (c) 2007-2021 the FFmpeg developers
  built with gcc 10 (Ubuntu 10.2.1-20ubuntu1)
  configuration: --prefix=/usr --extra-version=0+deb11u1ubuntu1 --toolchain=hardened --libdir=/usr/lib/aarch64-linux-gnu --incdir=/usr/include/aarch64-linux-gnu --arch=arm64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
[h264 @ 0xaaaad4239960] Format h264 detected only with low score of 1, misdetection possible!
[h264 @ 0xaaaad423a8f0] non-existing PPS 0 referenced
[extract_extradata @ 0xaaaad41ec6d0] Invalid NAL unit 0, skipping.
    Last message repeated 1 times
[h264 @ 0xaaaad423a8f0] Invalid NAL unit 0, skipping.
    Last message repeated 1 times
[h264 @ 0xaaaad423a8f0] non-existing PPS 0 referenced
[h264 @ 0xaaaad423a8f0] decode_slice_header error
[h264 @ 0xaaaad423a8f0] no frame!
[h264 @ 0xaaaad423a8f0] missing picture in access unit with size 185344
[extract_extradata @ 0xaaaad41ec6d0] Invalid NAL unit 0, skipping.
[extract_extradata @ 0xaaaad41ec6d0] No start code is found.
test.h264: Invalid data found when processing input

Could there be an issue with the way I write to my file using the server?

Here are the major functions I use to create the video file:

fp = open("test.h264", O_WRONLY | O_CREAT);
// Receive bytes from socket, returns number of bytes received called bytes
write(fp, buffer, bytes);

Any help would be appreciated, thanks.

Also for debugging I used

! videotestsrc pattern=snow

for gstreamer and this does work. So I think the video format is corrupted when sending over the network.

@DaneLLL

I figured out the problem. I made a mistake in the send function on client side. Server receives the video from client in this case. I messed up one of the parameters for send function.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.