0
I have a (quite large) set of files that is all H264 in an MPEG TS container. Due to time constraints I need to repackage this content into smooth streaming without transcoding it (transcoding would take too long).
I've been trying to figure out how to do this with ffmpeg, as it seems to have 2 different muxers that might be up for the task. I've tried both the 'smoothstreaming' muxer and the 'ismv' muxer, but with both of them I'm running into issues.
ffmpeg -i input.mpg -codec copy -f smoothstreaming ss_out
With this, I get the following error:
ffmpeg version N-79695-g675cfb2 Copyright (c) 2000-2016 the FFmpeg developers built with gcc 5.3.1 (Debian 5.3.1-14) 20160409 configuration: libavutil 55. 23.100 / 55. 23.100 libavcodec 57. 38.100 / 57. 38.100 libavformat 57. 35.100 / 57. 35.100 libavdevice 57. 0.101 / 57. 0.101 libavfilter 6. 44.100 / 6. 44.100 libswscale 4. 1.100 / 4. 1.100 libswresample 2. 0.101 / 2. 0.101 Input #0, mpegts, from 'input.mpg': Duration: 01:28:41.98, start: 2.040000, bitrate: 2500 kb/s Program 1 Stream #0:0[0x1e1]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p, 720x576 [SAR 16:11 DAR 20:11], 25 fps, 25 tbr, 90k tbn Stream #0:1[0x1e2](eng): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16p, 192 kb/s [smoothstreaming @ 0x2616340] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead. Last message repeated 1 times [smoothstreaming @ 0x2616340] No bit rate set for stream 0 Output #0, smoothstreaming, to 'ss_out': Metadata: encoder : Lavf57.35.100 Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 720x576 [SAR 16:11 DAR 20:11], q=2-31, 25 fps, 25 tbr, 50 tbn Stream #0:1(eng): Audio: mp2 (i[0][0][0] / 0x0069), 48000 Hz, stereo, 192 kb/s Stream mapping: Stream #0:0 -> #0:0 (copy) Stream #0:1 -> #0:1 (copy) Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
The other thing I tried is packaging it with ffmpeg into ismv:
ffmpeg -i input.mpg -c copy -movflags isml+frag_keyframe -f ismv ss_out.ismv
This works fine so far, but then I need the ismindex tool to create the manifest files, but this fails:
ismindex -n ss_out ss_out.ismv
Unable to read the MFRA atom in ss_out.ismv (mfra size mismatch)
Is there something I'm doing wrong, or is there maybe something wrong with my input file?
Your audio is MP2. ISMV seems to accept either AAC-LC or WMA Pro. So, try encoding audio to AAC. – Gyan – 2016-05-03T12:16:53.967
Thanks for that tip. I think that may have been the cause of some (if not all) of my issues. I've yet to test my files, but right now I've used the ismv muxer while at the same time encoding the audio to aac. I also removed the 'isml' from the movflags, it seems thats not necessary for non-live content (could have also been the issue I guess).
ffmpeg -i input.mpg -c:v copy -c:a aac -b:a 192k -movflags frag_keyframe -f ismv ss_out.ismv
After this ismindex will also run fine! – Sartsj – 2016-05-03T13:26:13.977
BTW, the 'smoothstreaming' muxer either only takes 'ismv' as input or there was something wrong with my input MPEGTS file. After packaging to ISMV first and then using the 'smoothstreaming' muxer, that also worked. However I never realized the output of that is actual chunks and manifests (the stuff that a webserver normally does on the fly with smooth streaming). I needed a set of ism/ismc/ismv files, which that does not generate. – Sartsj – 2016-05-03T13:30:18.967