0

The Problem

I've been fighting with this for days. I'm writing a video application for Android to be used on an Odroid C2. I've been simultaneously developing some scripts that utilize ffmpeg to produce files to be played on the Odroid.

My issue is that videos encoded with FFMPEG won't play. At first I thought it was my application, but they won't play from a jump drive, either. Videos produced by Adobe's Media Encoder work fine.

Both are encoding the same tiff image sequence. I've attached the MediaInfo screenshots below. If anyone could shed some light on something I don't know, it would be greatly appreciated.

Media Encoder

Media Encoder

FFMPEG

FFMPEG

Console Output

Here are some related console messages from Android. It looks like Android can't identify the codec for some reason. =/

12-19 22:14:56.216 16588-16602/? V/AmThumbnail: vp_open=amthumb:AmlogicPlayer=[f68dfff0:972000f],AmlogicPlayer_fd=[f68e0008:971fff7]
12-19 22:14:56.216 16588-16602/? V/AmThumbnail: android_open amthumb:AmlogicPlayer=[f68dfff0:972000f],AmlogicPlayer_fd=[f68e0008:971fff7] OK,h->priv_data=0xf68e0008
12-19 22:14:56.220 16588-16602/? I/exffmpeg: [hevc @ 0xf68c5800] 
12-19 22:14:56.220 16588-16602/? I/exffmpeg: No profile indication! (4)
12-19 22:14:56.220 16588-16602/? I/exffmpeg: [hevc @ 0xf68c5800] 
12-19 22:14:56.220 16588-16602/? I/exffmpeg: Error decoding profile tier level.
12-19 22:14:56.220 16588-16602/? I/exffmpeg: [hevc @ 0xf68c5800] 
12-19 22:14:56.220 16588-16602/? I/exffmpeg: Error parsing NAL unit #0.
12-19 22:14:56.220 16588-16602/? I/exffmpeg: [hevc @ 0xf68c5800] 
12-19 22:14:56.220 16588-16602/? I/exffmpeg: No profile indication! (4)
12-19 22:14:56.220 16588-16602/? I/exffmpeg: [hevc @ 0xf68c5800] 
12-19 22:14:56.220 16588-16602/? I/exffmpeg: error decoding profile tier level
12-19 22:14:56.220 16588-16602/? I/exffmpeg: [hevc @ 0xf68c5800] 
12-19 22:14:56.220 16588-16602/? I/exffmpeg: Error parsing NAL unit #0.
12-19 22:14:56.220 16588-16602/? I/exffmpeg: [hevc @ 0xf68c5800] 
12-19 22:14:56.220 16588-16602/? I/exffmpeg: SPS does not exist 
12-19 22:14:56.220 16588-16602/? I/exffmpeg: [hevc @ 0xf68c5800] 
12-19 22:14:56.220 16588-16602/? I/exffmpeg: Error parsing NAL unit #0.

...

12-19 22:14:56.336 16588-16602/? I/exffmpeg: [hevc @ 0xf68c5800] 
12-19 22:14:56.336 16588-16602/? I/exffmpeg: PPS id out of range: 0
12-19 22:14:56.336 16588-16602/? I/exffmpeg: [hevc @ 0xf68c5800] 
12-19 22:14:56.336 16588-16602/? I/exffmpeg: Error parsing NAL unit #0.
12-19 22:14:56.336 16588-16602/? I/exffmpeg: [mov,mp4,m4a,3gp,3g2,mj2 @ 0xf6887c00] 
12-19 22:14:56.336 16588-16602/? I/exffmpeg: decoding for stream 0 failed
12-19 22:14:56.337 16588-16602/? I/exffmpeg: [mov,mp4,m4a,3gp,3g2,mj2 @ 0xf6887c00] 
12-19 22:14:56.337 16588-16602/? I/exffmpeg: Could not find codec parameters for stream 0 (Video: hevc (hev1 / 0x31766568), 3840x2160, 33528 kb/s): unspecified pixel format
                                             Consider increasing the value for the 'analyzeduration' and 'probesize' options

Edit

This is the ffmpeg command being used. I'm encoding a test sequence of 300 frames.

ffmpeg -framerate 29.97 -start_number 2000 -i example_%05d.tif -c:v libx265 -preset ultrafast -crf 18 -vf "colormatrix=fcc:bt709" -pix_fmt yuv420p -color_range 2 output.mp4

FFMPEG Console Output

ffmpeg -y -framerate 29.97 -start_number 2000 -i attd_1p_%05d.tif -c:v libx265 -preset ultrafast -crf 18 -vf "colormatrix=fcc:bt709" -pix_fmt yuv420p -color_range 2 ../H265_TEST.mp4
ffmpeg version 3.1.5-1~xenial Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.2) 20160609
  configuration: --prefix=/usr --extra-version='1~xenial' --libdir=/usr/lib/ffmpeg --shlibdir=/usr/lib/ffmpeg --disable-static --disable-debug --toolchain=hardened --enable-pthreads --enable-runtime-cpudetect --enable-gpl --enable-shared --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv --enable-libkvazaar --enable-libopenh264 --enable-nonfree --enable-libfdk-aac --enable-libfaac
  libavutil      55. 28.100 / 55. 28.100
  libavcodec     57. 48.101 / 57. 48.101
  libavformat    57. 41.100 / 57. 41.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 47.100 /  6. 47.100
  libavresample   3.  0.  0 /  3.  0.  0
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
Input #0, image2, from 'attd_1p_%05d.tif':
  Duration: 00:00:10.01, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: tiff, rgb24, 3840x2160 [SAR 1:1 DAR 16:9], 29.97 tbr, 29.97 tbn, 29.97 tbc
x265 [info]: HEVC encoder version 1.9
x265 [info]: build info [Linux][GCC 5.3.1][64 bit] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2
x265 [info]: Main profile, Level-5 (Main tier)
x265 [info]: Thread pool created using 16 threads
x265 [info]: frame threads / pool features       : 5 / wpp(68 rows)
x265 [info]: Coding QT: max CU size, min CU size : 32 / 16
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge         : dia / 57 / 0 / 2
x265 [info]: Keyframe min / max / scenecut       : 25 / 250 / 0
x265 [info]: Lookahead / bframes / badapt        : 5 / 3 / 0
x265 [info]: b-pyramid / weightp / weightb       : 1 / 0 / 0
x265 [info]: References / ref-limit  cu / depth  : 1 / 0 / 0
x265 [info]: AQ: mode / str / qg-size / cu-tree  : 1 / 0.0 / 32 / 1
x265 [info]: Rate Control / qCompress            : CRF-18.0 / 0.60
x265 [info]: tools: rd=2 psy-rd=2.00 early-skip tmvp fast-intra
x265 [info]: tools: strong-intra-smoothing lslices=8 deblock
[mp4 @ 0x17c7d00] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Output #0, mp4, to '../H265_TEST.mp4':
  Metadata:
    encoder         : Lavf57.41.100
    Stream #0:0: Video: hevc (libx265) ([35][0][0][0] / 0x0023), yuv420p(pc), 3840x2160 [SAR 1:1 DAR 16:9], q=2-31, 29.97 fps, 11988 tbn, 29.97 tbc
    Metadata:
      encoder         : Lavc57.48.101 libx265
Stream mapping:
  Stream #0:0 -> #0:0 (tiff (native) -> hevc (libx265))
Press [q] to stop, [?] for help
frame=  300 fps= 12 q=-0.0 Lsize=  224166kB time=00:00:09.90 bitrate=185304.4kbits/s speed=0.389x    x    
video:224158kB audio:0kB subtitle:0kB other streams:0kB global headers:1kB muxing overhead: 0.003441%
x265 [info]: frame I:      2, Avg QP:20.61  kb/s: 544482.73
x265 [info]: frame P:     75, Avg QP:22.74  kb/s: 341028.20
x265 [info]: frame B:    223, Avg QP:25.66  kb/s: 127208.97
x265 [info]: consecutive B-frames: 2.6% 1.3% 0.0% 96.1% 

encoded 300 frames in 25.62s (11.71 fps), 183445.62 kb/s, Avg QP:24.90
9
  • Show your ffmpeg command and full console output. Offhand, it looks like different codec tags are used, which indicate difference in where the player looks for stream parameter sets.
    – Gyan
    Dec 20, 2016 at 5:24
  • ffmpeg -framerate 29.97 -i example_%05d.tif -c:v libx265 -preset ultrafast -vf colormatrix=fcc:bt709 output.mp4 Dec 20, 2016 at 6:08
  • I'm going to post the console output when I get back to work tomorrow. Thanks for the response. Dec 20, 2016 at 6:14
  • I edited the question to include the ffmpeg command and the console output. I modified the command because I was typing it from memory last night and forgot a couple arguments. Dec 20, 2016 at 13:45
  • Ok, try your command with -vtag hvc1 -strict -2 Check that the tag has changed in the output. Strange thing is that on Android, the decoder is ffmpeg!
    – Gyan
    Dec 20, 2016 at 13:53

1 Answer 1

1

With Mulvya's help, I figured out the issue. FFMPEG was using a codec tag of hev1, while Media Encoder was using hvc1. Nothing I tried in FFMPEG would change this.

Mulvya suggested I use mp4box to repackage. mp4box -add out.mp4 -new final.mp4 didn't work. But, after a little more searching, I ended up following the suggestion here and used mp4box to extract the raw .hvc file from the file that FFMPEG gave me, and repackaged it into a new mp4 file. That seemed to fix it.


Note

Something that doesn't make sense is the fact that I ran a Media Encoder file through FFMPEG with -c copy, and the resulting file had a codec tag of hev1, but it still played on the Odroid players. Based on that, I wouldn't have expected the solution above to work, but it did.

Edit - As pointed out by Mulvya, the explanation for the above note is that even with the tag hev1, the stream from Media Encoder has the PS where the player expects it.

3
  • The tag signals where the parameter sets can be found. Even with a tag of hev1, the Media Encoder stream has the PS where your player expects it.
    – Gyan
    Dec 20, 2016 at 15:24
  • That makes sense. Thanks so much for your help. Do you have a good resource suggestion for me to learn all of these lower level details? Dec 20, 2016 at 16:07
  • No single source, really. Trial/error and research as the issues arise.
    – Gyan
    Dec 20, 2016 at 16:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.