2

I want to convert DAV format video clips from CCTV recorders to AVI using command as below (convert test - 1.dav to test - 1.avi)

ffmpeg -y -i test\ -\ 1.dav -vcodec copy -movflags +faststart test\ -\ 1.avi

It works properly on x86_64 Linux with ffmpeg ver 2.4.13 and Synology with ffmpeg ver 2.0.2. File after converting is fully playable on Windows, Android, iPad and Linux. But when I try to convert it on Synology equipped with the newest version of software, then fails (ffmpeg ver 2.7.1). Below output from conversion process:

ffmpeg version 2.7.1 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.9.3 (crosstool-NG 1.20.0) 20150311 (prerelease)
configuration: --prefix=/usr --incdir='${prefix}/include/ffmpeg' --arch=arm --target-os=linux --cross-prefix=/usr/local/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi- --enable-cross-compile --enable-optimizations --enable-pic --enable-gpl --enable-shared --disable-static --enable-version3 --enable-nonfree --enable-libfaac --enable-encoders --enable-pthreads --disable-bzlib --disable-protocol=rtp --disable-muxer=image2 --disable-muxer=image2pipe --disable-swscale-alpha --disable-ffserver --disable-ffplay --disable-devices --disable-bzlib --disable-altivec --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libmp3lame --disable-vaapi --disable-decoder=amrnb --disable-encoder=zmbv --disable-encoder=dca --disable-encoder=ac3 --disable-encoder=ac3_fixed --disable-encoder=eac3 --disable-decoder=dca --disable-decoder=eac3 --disable-decoder=truehd --cc=/usr/local/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-ccache-gcc
libavutil      54. 27.100 / 54. 27.100
libavcodec     56. 41.100 / 56. 41.100
libavformat    56. 36.100 / 56. 36.100
libavdevice    56.  4.100 / 56.  4.100
libavfilter     5. 16.101 /  5. 16.101
libswscale      3.  1.101 /  3.  1.101
libswresample   1.  2.100 /  1.  2.100
libpostproc    53.  3.100 / 53.  3.100
Input #0, h264, from 'test - 1.dav':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: h264 (Main), yuv420p, 704x576, 25 fps, 25 tbr, 1200k tbn, 50 tbc
Output #0, avi, to 'test - 1.avi':
Metadata:
ISFT            : Lavf56.36.100
Stream #0:0: Video: h264 (H264 / 0x34363248), yuv420p, 704x576, q=2-31, 25 fps, 25 tbr, 50 tbn, 50 tbc
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[avi @ 0xb0ff0] H.264 bitstream malformed, no startcode found, use the video bitstream filter 'h264_mp4toannexb' to fix it ('-bsf:v h264_mp4toannexb' option with ffmpeg)
av_interleaved_write_frame(): Invalid data found when processing input
frame=    1 fps=0.0 q=-1.0 Lsize=       6kB time=00:00:00.02 bitrate=2300.0kbits/s    
video:40kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Conversion failed!

I have to mention that in each case, I use the same input file and the same ffmpeg syntax for conversion. The only differences are versions of ffmpeg. What is most strange, the newest version works wrong. What mistake/error I am doing? Any idea?

1 Answer 1

3

Newer ffmpeg version refuses to mux H.264 encoded video without startcodes to AVI. You should use -bsf:v h264_mp4toannexb as it is indicated in ffmpeg output. This will not reencode your video.

6
  • But the problem is that after conversion with -bsf:v h264_mp4toannexb option, first 2-3 sek of move (for example walking man) are very fast in display (using VLC or other player) and after 2-3 sek, movement are "ordinary" in speed. Is any possibility to correct it?
    – mackowiakp
    Sep 30, 2016 at 9:11
  • Does ffmpeg produce any warnings? You can try add -fflags +genpts or play with -copyts/-copytb/-start_at_zero options. I can not find more without video sample. Sep 30, 2016 at 9:21
  • 1
    BTW, -movflags +faststart seems useless in your command, because this option is for mp4 muxer only. Sep 30, 2016 at 9:22
  • OK. Now I use syntax find ./ -type f -mmin +10 -name "*.dav" -exec ffmpeg -y -i {} -bsf:v h264_mp4toannexb -fflags +genpts {}.avi \;
    – mackowiakp
    Sep 30, 2016 at 11:45
  • If You want to test, take sample clip from my Dropbox. Link https://dl.dropboxusercontent.com/u/79280403/test.dav
    – mackowiakp
    Sep 30, 2016 at 11:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .